Thursday, 11 February 2010

cdecl on the web

cdecl is a really useful tool for working out what a C type declaration is in English. For example:
const char** x
is translated into
declare x as pointer to pointer to const char
That is a very simple example, but it really comes into its own when given something nasty, like this:
char (*(*x())[5])()
which is:
declare x as function returning pointer to array 5 of pointer to function returning char
And you can go the other way too:
declare x as pointer to const pointer to int
becomes:
int * const *x
Which is all rather nice.

What is really useful is that it is available online at http://www.cdecl.org.

No comments: