cdecl (was on the fringe of C syntax/semantics)

Chris Torek chris at mimsy.UUCP
Sun Oct 15 15:43:23 AEST 1989


In article <334 at oha.UUCP> tony at oha.UUCP (Tony Olekshy) writes:
>    (echo `cat` | cdecl) << \_end_
>    declare foo as pointer to function (a,b) returning pointer to
 	...
>Generates:
>    char **(*(**(*(*(*(*(*foo)(a, b))(c, d))[3])(e, f))[4][2])(g, h))[5]

This depends on your cdecl.  Old ones accept only a single `argument' in
parentheses.  This is enough to work with, although that cdecl will never
produce things like

	int (*func(short (*arg[5])(char (**)(long *(*)[3]))))(char *(*)) {
		... <code goes here, using argument `arg'> ...
	}

(which might well be a good thing!).

>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?

Yes, although casting `x' to something like that and then discarding the
result is not particularly exciting :-) .
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list