MSC __STDC__ strange value

Richard H. Gumpertz rhg at cpsolv.UUCP
Wed Dec 6 05:47:47 AEST 1989


In article <223 at bohra.cpg.oz> ejp at bohra.cpg.oz (Esmond Pitt) writes:
>For some strange reason, the MSC 5.1 compiler defines __STDC__ as 0, so
...
>Why?

On page "Update-54" the manual entry for __STDC__ reads:
	The integer constant 0.  If equal to 1, this macro indicates
	full compliance with the ANSI proposed standard for the C
	programming language.
I suspect Microsoft extrapolated from the standard's definition of __STDC__
in which future versions may define values such as 2, 3, etc. to mean revised
C standards.  They extrapolated backward to 0, meaning close to but not fully
compliant.  A plausible (but strange) hack I suppose.

By the way, there is an interesting anomaly: The standard cannot say anything
about whether __STDC__ is defined or what its value should be for non-conforming
implementations -- it controls only the value for conforming ones!  Hence,
defining __STDC__ in a non-conforming implementation is perfectly legal so
long as conformance is not claimed elsewhere.  Of course, no sane implementor
of a non-conforming compiler should define it as 1 (or greater, I suppose)
unless he wants unhappy customers.  Sigh.     :-)
-- 
===============================================================================
| Richard H. Gumpertz rhg%cpsolv at uunet.uu.NET -or- ...uunet!amgraf!cpsolv!rhg |
| Computer Problem Solving, 8905 Mohawk Lane, Leawood, Kansas 66206-1749      |
===============================================================================



More information about the Comp.lang.c mailing list