__STDC__ and non-conforming ANSI C compilers

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Dec 27 16:54:29 AEST 1988


In article <6093 at hoptoad.uucp> gnu at hoptoad.uucp (John Gilmore) writes:
-Doug, you seem to be trying to tell us that ANSI C implementations
-should all be worthless because they are so pedantic that they can't be
-used.

To the contrary, I think implementations that conform to the Standard
will be extremely useful.

-The code that I have so far written using __STDC__ uses it to
-determine whether the historic-C preprocessor was there or whether the
-committee-designed preprocessor was there.

That of course is one possible use for __STDC__, but by no means the
only one and probably not the most important one.

-This is necessary because
-the committee designed a new syntax incompatible with every existing
-piece of source code, and disabled the features that old code used.

That is of course blatantly false.  I know of an experiment involving
the recompilation of every piece of UNIX system source code using an
experimental (intended to be ANSI-conforming) compiler, and very
little of it was "broken" by the standard-conforming implementation.

Now, code that fully uses the features of ANSI C will not be backward-
portable to non standard-conforming compilers, but that was never a
constraint (and was deemed impossible anyway).

-Now Doug suggests that the only thing that can be relied upon to
-distinguish the two environments, be turned off if a minor extension
-(like the ability to call open() with either two or three arguments,
-without declaring it variadic, or a fortran keyword) is also accepted
-by the compiler.

What's a "minor" violation for you may well be "major" for others.

-There is probably a use for __STDC__ other than determining whether
-you are on an "old" or "ansi" style compiler, but I doubt such uses are
-important enough to break the main job of __STDC__.

Funny, that's MY argument!

-But most importantly, you can rave all you want about what
-non-conforming compilers do with __STDC__, but it's all that much hot
-air.  "We don't conform, nyaah." is a perfectly reasonable response.

But subverting features of the Standard specifically designed to be used
by application source code to test for implementation standard conformance
is NOT reasonable; it's some sort of crime.



More information about the Comp.std.c mailing list