Article View: comp.bugs.4bsd
Article #529Re: C preprocessor question
From: apn
Date: Thu, 29 Jan 1987 00:33
Date: Thu, 29 Jan 1987 00:33
41 lines
1762 bytes
1762 bytes
in article <818@wjvax.wjvax.UUCP>, brett@wjvax.UUCP (Brett Galloway) says:
>
> 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?
> --
I don't think this should work....
try running 'cc -E file.c' for some clues.
this will give you a output essentially a file
which is what your program looks like to the actual
c compiler after macros are expanded.
CPP evaluates the macro 'GROUP' with arguments 0,0
to be:
(((0) << 8) | ( 0 ))
which is not a valid c line if it is stand alone.
be carefull.. CPP is for just that , preprocessing.... i.e.
#if's are compile time options and not
run time options.
--
Alex P Novickis
UUCP: {seismo, sun, ihnp4, 'etc' }!ptsfa!nonvon!apn
{* Only those who attempt the absurd ... will achieve the impossible *}
{* I think... I think it's in my basement... Let me go upstairs and check. *}
{* -escher *}
Technical Details
Message-ID:
<1493@nonvon.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!gatech!lll-lcc!ptsfa!nonvon!apnReferences:
<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!gatech!lll-lcc!ptsfa!nonvon!apn From: apn@nonvon.UUCP Newsgroups: comp.bugs.4bsd Subject: Re: C preprocessor question Message-ID: <1493@nonvon.UUCP> Date: Wed, 28-Jan-87 19:33:10 EST Article-I.D.: nonvon.1493 Posted: Wed Jan 28 19:33:10 1987 Date-Received: Fri, 30-Jan-87 04:41:37 EST References: <818@wjvax.wjvax.UUCP> Organization: NONVON Systems Computer Research Group Lines: 41