Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!ames!nap1!ark1!nems!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: cdecl (was on the fringe of C syntax/semantics) Message-ID: <20182@mimsy.UUCP> Date: 15 Oct 89 05:43:23 GMT References: <789@crdos1.crd.ge.COM> <457@usage.csd.unsw.oz> <20077@mimsy.UUCP> <334@oha.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 27 In article <334@oha.UUCP> tony@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 *(*)) { ... ... } (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@cs.umd.edu Path: uunet!mimsy!chris