#ifdef without identifier

Stephen Clamage steve at taumet.com
Sun Dec 16 07:18:02 AEST 1990


dolf at idca.tds.PHILIPS.nl (Dolf Grunbauer) writes:

|We just traced a wierd bug.  After some debugging it turned out that parts
|of the code was not compiled. The code was something like:

|#ifdef	/* FLAG */
|	do_something();
|#endif

|Obviously the source was compiled with -DFLAG. The code between the #ifdef
|and #endif was not included in the compilation and everyone looked over this
|error (?). The compiler gave no warnings or errors, but I think it should do
|so in this case as an 'ifdef' always requires an identifier...

According to the ANSI standard, #ifdef must be followed by an identifier,
and the compiler must reject as an error the code as given.  If your
compiler is intended to be ANSI-compliant, you have a legitimate cause
for complaint to the vendor.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.lang.c mailing list