#if query

Chris Torek torek at elf.ee.lbl.gov
Sat Apr 6 10:35:08 AEST 1991


In article <1991Apr5.161945.889 at vixvax.mgi.com> cepek at 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 at ee.lbl.gov



More information about the Comp.std.c mailing list