cdecl and c++decl: Explain C and C++ Declarations

cdecl and c++decl translate complicated C and C++ declarations into English and can also generate declarations from plain-language descriptions. They are useful when pointer, function-pointer, or nested type syntax becomes hard to read.

Interactive mode

cdecl
explain int (*signal(int, int (*)(int)))(int)
declare p as pointer to integer
quit

c++decl uses C++ terminology and syntax where supported.

Command-line mode

cdecl explain 'char *(*f)(int)'

Exact syntax and available features vary by implementation, so check man cdecl or the package documentation installed on your system.

For modern C and C++ work, compiler diagnostics, IDE type information, and tools such as Clang can often provide additional context, but cdecl remains a handy way to decode dense declarations.

Leave a Comment