Article View: comp.std.c
Article #1891Re: Another sizeof question
From: Henry Spencer
Date: Sun, 28 Oct 1990 22:37
Date: Sun, 28 Oct 1990 22:37
23 lines
1326 bytes
1326 bytes
In article <13171@crdgw1.crd.ge.com> volpe@camelback.crd.ge.com (Christopher R Volpe) writes: >Can someone tell me whether "sizeof" expressions are allowed as >operands of "#if"? ... In ANSI C, no, they are not. Preprocessing is done before there is any notion of declarations, types, storage layout, or sizes. In a #if, `sizeof' is just another identifier. >...The Bible says "sizeof" yields a constant integer, >and that #if requires an integral constant expression, so I can't >tell what's wrong... It's not clear which Bible you are reading. :-) Is it the Old Testament (K&R1), the New Testament (K&R2), or the New American Edition (ANSI)? In a sufficiently modern and complete edition, you will find the rule against this down in the fine print. >BTW, I'm using gcc to compile. Note that GNU C and standard C are only somewhat related. -- "I don't *want* to be normal!" | Henry Spencer at U of Toronto Zoology "Not to worry." | henry@zoo.toronto.edu utzoo!henry
Technical Details
Message-ID:
<1990Oct28.223702.27918@zoo.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!henryReferences:
<13171@crdgw1.crd.ge.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Another sizeof question Message-ID: <1990Oct28.223702.27918@zoo.toronto.edu> Organization: U of Toronto Zoology References: <13171@crdgw1.crd.ge.com> Date: Sun, 28 Oct 90 22:37:02 GMT