C preprocessor question
jtr485 at umich.UUCP
jtr485 at umich.UUCP
Sat Jan 31 01:46:11 AEST 1987
In article <818 at wjvax.wjvax.UUCP>, brett at wjvax.UUCP writes:
> I have a question about the C preprocessor. I have the following code
> fragment, which fails to compile on my system (4.2BSD):
>
> #define GROUP(group,subgroup) (((group) << 8) | (subgroup))
>
> #if GROUP(0,0)
> #endif
>
> The #if chokes for some reason. Can anyone in comp.lang.c see my error?
> If there is no error, is this a known bug of the 4.2BSD cpp?
> Brett Galloway
What do you expect his to do?
The #if is not going to evaluate the expression (((0) << 8) | (0))
The #if takes an expression defined (recursively) by:
an <expression> is
1) an integer string
or 2) (<expression> | <expression>)
or 3) (<expression> & <expression>)
and nothing else.
The only test you could perform on GROUP would be #ifdef.
--j.a.tainter
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list