C preprocessor question

tps at sdchem.UUCP tps at sdchem.UUCP
Thu Jan 29 15:40:27 AEST 1987


In article <818 at wjvax.wjvax.UUCP> brett at wjvax.UUCP (Brett Galloway) 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

I have replicated your reported behavior on our 4.3BSD system.
Sure looks like a bug to me.  The surprising thing is that it goes away
if you just replace GROUP by hand.  That is,
	
	#if (((0) << 8) | (0))
	#endif
works fine.

|| Tom Stockfisch, UCSD Chemistry	tps%chem at sdcsvax.UCSD



More information about the Comp.bugs.4bsd.ucb-fixes mailing list