Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: #define foo() bar /* ANSII legal? Message-ID: <22240@mimsy.umd.edu> Date: 2 Feb 90 06:43:09 GMT References: <164105@<1990Jan30> <6200025@ux1.cso.uiuc.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 35 (The answer to the original question is `yes'. Almost anything is legal as replacement text, including unbalanced parentheses, for instance.) (Incidentally, it is `ANSI', not `ANSII': ANSI = American National Standards Institute. The one with two `I's is ASCII: American Standard Code for Information Interchange.) In article <6200025@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu writes: >What about: > #define foo bar() > n = *foo(); >You would get: > n = *bar()(); >Which would be ok if bar() is defined as a function that returns a pointer >to a function returning a (typeof (n)). Right? Obscure? It could be correct, but not as given here: the binding is such that this is handled as bar() call bar () call the function so located * indirect so bar() would have to return a pointer to a function returning a pointer to a type compatible with variable `n'. If `n' were `int', for instance: int *(*bar(int))(char *); int n; n = *bar(3)("hello world"); is legal. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris