Want the word on __STDC__
Eamonn McManus
em at dce.ie
Fri Mar 8 04:55:37 AEST 1991
fred at mindcraft.com (Fred Zlotnick) writes:
>... since we know that
>nonconforming implementations do in fact sometimes define __STDC__ to
>something other than 1, it would be useful to protect your code by using
>the test
> #if __STDC__ == 1
>rather than
> #ifdef __STDC__
There are problems with that, though, quite apart from otherwise
conforming hypothetical implementations that define __STDC__ to be other
than 1. The replacement of undefined identifiers by 0 may have been a de
facto Unix standard but it was nowhere mentioned in K&R1 so it would have
been reasonable for a pre-standard implementation to make it an error for
a #if to contain an undefined identifier.
If I want my code to run on pre-standard implementations (which presumably
I do if I care about __STDC__) then I am reluctant to depend on
#if __STDC__
or
#if __STDC__ == 1
rather than
#ifdef __STDC__
which would have been safe had it not been for cretinous implementors who
made half-standard implementations with __STDC__ defined but 0.
,
Eamonn
More information about the Comp.std.c
mailing list