Friday, 17 August 2007

cdecl

Cdecl (and c++decl) is a program for encoding and decoding C (or C++) type declarations. The C language is based on the (draft proposed) X3J11 ANSI Standard;

root@dvm-desktop:/home/dvm# cdecl

Type `help' or `?' for help
cdecl> ?
[] means optional; {} means 1 or more; <> means defined elsewhere
commands are separated by ';' and newlines
command:
declare as
cast into
explain
set or set options
help, ?
quit or exit
english:
function [( )] returning
array [] of
[{ const | volatile | noalias }] pointer to

type:
{[] [{}] []}
{ struct | union | enum }
decllist: a comma separated list of , or as
name: a C identifier
gibberish: a C declaration, like 'int *x', or cast, like '(int *)x'
storage-class: extern, static, auto, register
C-type: int, char, float, double, or void
modifier: short, long, signed, unsigned, const, volatile, or noalias
cdecl>
cdecl> declare fptab as array of pointer to function returning pointer to char
char *(*fptab[])()
cdecl>

No comments: