Want the word on __STDC__

Ray Butterworth rbutterw at watmath.waterloo.edu
Tue Mar 12 05:37:22 AEST 1991


In article <622 at taumet.com> steve at taumet.com (Stephen Clamage) writes:
>rbutterw at watmath.waterloo.edu (Ray Butterworth) writes:
>>The failure to fully define __STDC__ was obviously a mistake,
>>and some vendors have thoroughly abused it.
>Wait a minute!  My copy of X3.159-1989 says __STDC__ is defined as
>"the decimal constant 1".  That seems about as clear and fully-defined
>as it could be.

By "fully define" I meant that it should mention its intended use
and explicitly forbid other uses.

>From: gwyn at smoke.brl.mil (Doug Gwyn)
>In article <1991Mar7.194733.18150 at watmath.waterloo.edu> rbutterw at watmath.waterloo.edu (Ray Butterworth) writes:
>>Perhaps the next version of the standard could denegrate __STDC__
>>and introduce a new definition, say something like
>>   #define __ANSI_X3_159__ 1989
>The real problem is that the standard can constrain only the behavior
>of CONFORMING implementations; nonconforming implementations can do
>whatever they please, including pretending to be standard conformant.

If instead of simply saying that __STDC__ will be 1, the Standard had
explicitly said something like __STDC__ will be 1 for X3.159-1989,
will have other values for later versions of the standard, and all
values of this macro are reserved by the Standard, things would have
been better.  Sure, it could still be abused, but there would be
less justification for the abuse.  Simply saying that it is 1 made
it very easy for some people to interpret this as meaning that
one should define it as something else to indicate non conformance.

>Your suggestions did not address this fundamental problem any better
>than the existing specification for __STDC__ did.  I am of the opinion
>that there is no method by which any standard could solve the problem.

Certainly there is no guaranteed solution, but one can make things
more difficult to abuse.  The name ANSI_X3_159 sort of indicates
that the name belongs to ANSI Standard C.  The current (presumptuous)
name could (and is) easily claimed by anyone else that wants to
declare their version as "standard" (and not necessarily your standard).



More information about the Comp.std.c mailing list