Want the word on __STDC__

Ray Butterworth rbutterw at watmath.waterloo.edu
Fri Mar 8 05:47:33 AEST 1991


In article <2986 at cirrusl.UUCP> dhesi%cirrusl at oliveb.ATC.olivetti.com (Rahul Dhesi) writes:
>First, it is quite possible that a future ANSI C standard will bump up
>the value of __STDC__ to 2, thus breaking code that assumes that
>(__STDC__ != 1) implies (not standard C).

The failure to fully define __STDC__ was obviously a mistake,
and some vendors have thoroughly abused it.

Perhaps the next version of the standard could denegrate __STDC__
and introduce a new definition, say something like
   #define __ANSI_X3_159__ 1989
and explicitly say that
   #if defined(__ANSI_X3_159__)
is the recommended test for an ANSI Standard compiler.
One could also use tests such as
   #if __ANSI_X3_159__ < 2001
   #if __ANSI_X3_159__ == 1989
to check for the version of the Standard.
They should also state that if the symbol is defined with any
value other than those explicitly listed in the standard,
the compiler must generate a fatal error, rather than leaving
the behaviour as undefined as it is now with __STDC__.

If they really like the __STDC__ name though, they could
always say the same as above, but with (__STDC__ == 1)
having the same meaning as (__STDC__ = 1989), but using a
new symbol would probably avoid confusion.



More information about the Comp.std.c mailing list