cdecl is the business

I was just having a whinge about const in C, and how confusing it is trying to work out what I actually want. Stephen piped up and said “run cdecl .. and shutup!”.

[michael@concordia ~] cdecl
const char **p;
declare p as pointer to pointer to const char;
char * const * p;
declare p as pointer to const pointer to char;
const char const * const * p;
declare p as pointer to const pointer to const char const;
const char * const * p;
declare p as pointer to const pointer to const char;
const char * const * const p;
declare p as const pointer to const pointer to const char;

I’m still not sure I can parse it in my head, but next time I get stuck cdecl can come to my rescue.

Posted by mike on Tuesday February 8th, 2005, tagged with , ,

Comments are closed.