📅 2014-Aug-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cdecl, declaration ⬩ 📚 Archive
Type declarations in C or C++ can sometimes look confusing. cdecl is a commandline tool that can convert a type declaration into plain English that might be easier to understand.
To install cdecl:
$ sudo apt install cdecl
To use cdecl:
$ cdecl explain "const int* ip;" declare ip as pointer to const int
To use cdecl in interactive mode:
$ cdecl Type `help' or `?' for help cdecl> explain const int* ip; declare ip as pointer to const int cdecl>
Note that I found that cdecl fails on even simple declarations which are legal in C or C++:
$ cdecl explain "const int const * ip;" syntax error
The cdecl can also be used online here.
Tried with: Cdecl 2.5-13 and Ubuntu 14.04