Article View: comp.std.c
Article #1807Re: 'sizeof' in preprocessing.
From: Stan Brown, Oak Road Systems
Date: Mon, 08 Oct 1990 15:24
Date: Mon, 08 Oct 1990 15:24
24 lines
1509 bytes
1509 bytes
In article <1990Oct6.092032.345@csc.canberra.edu.au>, eyal@echo.canberra.edu.au (Eyal Lebedinsky) writes:
> Reading the standard, any 'constant-expression' is valid for #if, and sizeof
> is yielding a constant. So, one should be able to say:
> #if sizeof (a) == 2
> etc. I read it a while ago and though it too bad my compiler won't do this.
> No separate cpp will do it (unless it learns some C).
> Comments? I was reading 3.8.1 7/88 draft.
I thing the preprocessor doesn't know C--specifically, the preprocessor
doesn't know your variable names. For example, the following should be
a strictly conforming program and should compile successfully, assuming
"mumble" occurs nowhere else in the compilation:
int mumble;
#ifdef mumble
# error The C preprocessor goofed
#else
/* This is the way it's supposed to work. */
#endif
The above opinions are not attributable to any other person or company.
email: browns@iccgcc.decnet.ab.com
Stan Brown, Oak Road Systems, Cleveland, Ohio, U.S.A. +1 216 371 0043
Technical Details
Message-ID:
<1326.271053f5@iccgcc.decnet.ab.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!abvax!iccgcc!brownsReferences:
<12672@ogicse.ogi.edu> <1990Oct6.092032.345@csc.canberra.edu.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!abvax!iccgcc!browns From: browns@iccgcc.decnet.ab.com (Stan Brown, Oak Road Systems) Newsgroups: comp.std.c Subject: Re: 'sizeof' in preprocessing. Message-ID: <1326.271053f5@iccgcc.decnet.ab.com> Date: 8 Oct 90 15:24:50 GMT References: <12672@ogicse.ogi.edu> <1990Oct6.092032.345@csc.canberra.edu.au> Lines: 24