__STDC__ and non-conforming ANSI C compilers

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Jan 17 01:21:36 AEST 1989


In article <2788 at mhres.mh.nl> jv at mhres.mh.nl (Johan Vromans) writes:
>From article <9369 at smoke.BRL.MIL>, by gwyn at smoke.BRL.MIL (Doug Gwyn ):
>> Apart from screaming at MicroSoft about this brain damage, I guess we
>> all have now been forced to use "#if __STDC__" to survive that stupid
>> decision.
>... which will yield a nice warning "__STDC__ not defined,
>treated as zero" in at least one C implementation I know.

Strange implementation, but at least you can ignore such warnings.
If this becomes a real problem for you, you can use
	#if defined(__STDC__) && __STDC__
but then there are C implementations that don't allow defined() to
be used in expressions, if at all, so the next attempt is
	#ifdef __STDC__
	#if __STDC__
but if somebody's implementation stupidly #defines __STDC__ as the
symbol "almost" then you're completely out of luck.

Obviously the original desire for
	#ifdef __STDC__
to work right is a sensible desire; it avoids the warnings you
mention without causing any other problems, IF the compiler vendors
would get their act together and not #define __STDC__ unless they
(fully) conform to the Standard.



More information about the Comp.std.c mailing list