🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #526

Re: C preprocessor question

#526
From: tps
Date: Thu, 29 Jan 1987 05:40
22 lines
1319 bytes
In article <818@wjvax.wjvax.UUCP> brett@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@sdcsvax.UCSD
Technical Details
Message-ID: <625@sdchema.sdchem.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ucbvax!sdcsvax!sdchem!tps
References: <818@wjvax.wjvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ucbvax!sdcsvax!sdchem!tps
From: tps@sdchem.UUCP
Newsgroups: comp.bugs.4bsd
Subject: Re: C preprocessor question
Message-ID: <625@sdchema.sdchem.UUCP>
Date: Thu, 29-Jan-87 00:40:27 EST
Article-I.D.: sdchema.625
Posted: Thu Jan 29 00:40:27 1987
Date-Received: Fri, 30-Jan-87 01:46:43 EST
References: <818@wjvax.wjvax.UUCP>
Sender: news@sdchem.UUCP
Reply-To: tps@sdchemf.UUCP (Tom Stockfisch)
Organization: UC San Diego
Lines: 22
Keywords: preprocessor, UNIX, BSD