on the fringe of C syntax/semantics

Tony Olekshy tony at oha.UUCP
Sun Oct 15 06:07:08 AEST 1989


In message <20077 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
>
> One can use the freely-available (possibly public domain) `cdecl'
> program to come up with things like [...]
>
> 	char **(*(**(*(*(*(*(*foo)())())[3])())[4][2])())[5]
> 
> Of course, in ANSI C, one should include the types of the arguments to
> each of the functions....

FYI:

    (echo `cat` | cdecl) << \_end_
    declare foo as pointer to function (a,b) returning pointer to
    function (c, d) returning pointer to array 3 of pointer to
    function (e, f) returning pointer to array 4 of array 2 of
    pointer to pointer to function (g, h) returning pointer to
    array 5 of pointer to pointer to char
    _end_

Generates:

    char **(*(**(*(*(*(*(*foo)(a, b))(c, d))[3])(e, f))[4][2])(g, h))[5]

So, isn't:

    typedef int a, b, c, d, e, f;
    (char **(*(**(*(*(*(*(*)(a, b))(c, d))[3])(e, f))[4][2])(g, h))[5])x;

ok?

--
Yours, etc., Tony Olekshy (...!alberta!oha!tony or tony at oha.UUCP).



More information about the Comp.lang.c mailing list