#define foo() bar /* ANSII legal?
Chris Torek
chris at mimsy.umd.edu
Fri Feb 2 17:43:09 AEST 1990
(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 at ux1.cso.uiuc.edu> phil at 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 at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list