__STDC__ and non-strictly conforming ANSI C compilers

Guy Harris guy at auspex.UUCP
Fri Dec 16 04:54:29 AEST 1988


 >__STDC__ is intended to indicate standard conformance, and nothing else,
 >certainly not "sort of conforming but different in ways I
 >think you might like, sorry if it breaks your code".

I'll certainly agree with that for

 >Please don't define __STDC__ at all for non standard-
 >conforming implementations, even if they provide a lot of
 >so-called "ANSI C" features.

There have been reports of a compiler that defines __STDC__ even though
it provides *some*, but not all, ANSI C features; the authors of that
compiler should be horsewhipped.

However, what about a compiler that can be run in at least two modes,
one of which is "strict tight-sphincter ANSI C", meaning "no, there are
NO macros declared, or objects defined, that aren't listed by name in
the ANS, and there are NO other extensions permitted either", and one of
which is "ANSI C plus extensions", e.g. "we define some things in
#include files that may pollute the namespace"?

For instance, consider a program written for a POSIX environment, so
that it might not compile in "strict ANSI C" mode, but written so that
it can use function prototypes if they're present?  Should __STDC__ be
defined by the compiler running in "ANSI C plus extensions" mode, so
that the code can use "__STDC__" to determine whether function
prototypes, or "#" and "##", or... are supported?



More information about the Comp.std.c mailing list