🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2690

Re: #if query

#2690
From: Chris Torek
Date: Sat, 06 Apr 1991 00:35
35 lines
1311 bytes
In article <1991Apr5.161945.889@vixvax.mgi.com> cepek@vixvax.mgi.com writes:
>Does ANSI really state that
>
>       #if ABC == DEF
>
>evaluates to FALSE if symbol DEF is not defined!?

No.  However, in this case,

	#if DEF

is the same as

	#if 0

Furthermore, if ABC is either #define'd as the preprocessor value 0
(i.e., a preprocessor expression which evaluates to 0) or is undefined,

	#if ABC == DEF

is the same as

	#if 0 == 0

or

	#if 1

X3.159-1989 merely states that at that particular point in preprocessor
arithmetic, all `variable names' are treated as zero.  (Macro expansion
has already taken place, replacing any #define'd tokens with their
definitions.)
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov
Technical Details
Message-ID: <11854@dog.ee.lbl.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!ucsd!dog.ee.lbl.gov!elf.ee.lbl.gov!torek
References: <1991Apr5.161945.889@vixvax.mgi.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!ucsd!dog.ee.lbl.gov!elf.ee.lbl.gov!torek
From: torek@elf.ee.lbl.gov (Chris Torek)
Newsgroups: comp.std.c
Subject: Re: #if query
Message-ID: <11854@dog.ee.lbl.gov>
Date: 6 Apr 91 00:35:08 GMT
References: <1991Apr5.161945.889@vixvax.mgi.com>
Reply-To: torek@elf.ee.lbl.gov (Chris Torek)
Organization: Lawrence Berkeley Laboratory, Berkeley
Lines: 35
X-Local-Date: Fri, 5 Apr 91 16:35:09 PST