__STDC__ and non-strictly conforming ANSI C compilers

Ray Butterworth rbutterworth at watmath.waterloo.edu
Sat Dec 17 00:45:52 AEST 1988


In article <1988Dec15.183822.2559 at utzoo.uucp>, henry at utzoo.uucp (Henry Spencer) writes:
> it would appear to me
> that only "#if __STDC__" is guaranteed to tell you whether it's a
> conforming implementation

I think everyone is missing something very obvious.
The only thing that is guaranteed is that "#if !defined(__STDC__)"
will guarantee that the compiler is NOT an ANSI Standard C compiler.

There is nothing to stop a compiler (or cpp or any header file)
from defining __STDC__, so long as that compiler doesn't make claims
to being an ANSI Standard C compiler.  I don't believe that ANSI
has registered __STDC__ as their trademark.  It might have been
a better idea to use the identifier __ANSI__ instead, since they
could then legitimitely complain if say BSD were to put something
like  "#define __STDC__(a,b,c) printf(a,b,c)"  into their stdio.h.
It would be a silly thing to do, but as long as BSD doesn't claim
to be a "conforming ANSI implementation", it can do what it likes.

i.e. The Standard only says how conforming implementations must behave.
It has no control over how any compiler or library behaves if that
compiler or library doesn't claim to be fully conforming.



More information about the Comp.std.c mailing list