Article View: comp.bugs.4bsd
Article #541Re: C preprocessor question
From: jtr485
Date: Fri, 30 Jan 1987 15:46
Date: Fri, 30 Jan 1987 15:46
25 lines
1361 bytes
1361 bytes
In article <818@wjvax.wjvax.UUCP>, brett@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
Technical Details
Message-ID:
<55@umich.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-spam!ames!styx!lll-lcc!well!msudoc!umich!jtr485References:
<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!rutgers!sri-spam!ames!styx!lll-lcc!well!msudoc!umich!jtr485 From: jtr485@umich.UUCP Newsgroups: comp.bugs.4bsd Subject: Re: C preprocessor question Message-ID: <55@umich.UUCP> Date: Fri, 30-Jan-87 10:46:11 EST Article-I.D.: umich.55 Posted: Fri Jan 30 10:46:11 1987 Date-Received: Tue, 3-Feb-87 20:42:34 EST References: <818@wjvax.wjvax.UUCP> Organization: EECS, University of Michigan Lines: 25 Keywords: preprocessor, UNIX, BSD