Is it only ANSI C that allow #if to compare symbols?
Doug Gwyn
gwyn at smoke.brl.mil
Tue Jan 22 08:12:50 AEST 1991
In article <1991Jan21.090551.12909 at resam.dk> andrew at resam.dk (Leif Andrew Rump) writes:
-The (Danish version of the) Ansi K&R compiler gives the following example:
[I assume you mean that some manual for some compiler gives the example.]
-#define SYSTEM SPARC
-#if SYSTEM == SPARC
- ...
-#else
- ...
-#endif
-I was not able to find the book this morning but i _don't_ remember any
-defines giving the symbol SPARC any numerical value.
If not, then the example is incorrect.
(Well, actually it would work due to the expression being evaluated as 0==0,
but SYSTEM cannot be used to select among different system types in this way
unless each system-type macro is given a distinct value.)
More information about the Comp.lang.c
mailing list