🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1892

Re: Another sizeof question

#1892
From: Yiannis Papelis
Date: Sun, 28 Oct 1990 17:57
19 lines
1228 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"? I'm trying to do some conditional compilation
>based on the size of some data structure, and I get parse errors
>before sizeof. The Bible says "sizeof" yields a constant integer,
>and that #if requires an integral constant expression, so I can't
>tell what's wrong. Can someone clue me in? Thanks.
>
>BTW, I'm using gcc to compile.
>

sizeof expressions 'become' a constant integer at compile time.
In other words only the compiler knows what sizeof(whatever) is.
Since the preproccessor runs before the compiler it has no way
of knowing the value of sizeof.

Yiannis E. Papelis
Department of Electrical and Computer Engineering, University of Iowa.
yiannis@eng.uiowa.edu
Technical Details
Message-ID: <1990Oct28.175729.23696@ccad.uiowa.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ns-mx!ccad.uiowa.edu!yiannis
References: <13171@crdgw1.crd.ge.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ns-mx!ccad.uiowa.edu!yiannis
From: yiannis@ccad.uiowa.edu (Yiannis Papelis)
Newsgroups: comp.std.c
Subject: Re: Another sizeof question
Message-ID: <1990Oct28.175729.23696@ccad.uiowa.edu>
Date: 28 Oct 90 17:57:29 GMT
References: <13171@crdgw1.crd.ge.com>
Organization: CAD-Research, U. of Iowa, Iowa City, Iowa
Lines: 19