A convention for defining __STDC__
Gregg Townsend
gmt at arizona.edu
Sun Jan 22 04:47:56 AEST 1989
In article <915 at sfmin.UUCP> dfp at attunix.att.com (Dave Prosser) writes:
>I would propose that __STDC__ be #defined to be 0 in C compilation systems
>that meet all ANSI C conformance requires except for:
> 1. the inclusion of nonconforming "common extensions" listed in A.6.5,
> 2. not issuing otherwise required diagnostics when language extensions
> are used, and/or
> 3. extra names declared or defined in standard headers.
>If __STDC__ is 1, the compilation system must be conforming.
This is a good solution and I encourage everyone to give it serious thought.
The most important function of __STDC__ is to distinguish between
old-style compilers (no prototypes, no token pasting, etc.) and new-style
ones. This distinction will be testable by a simple #ifdef __STDC__.
Some people also wish to test for perfect conformance to the standard, and
this is served by an equally simple #if __STDC__==1 test.
Certain current systems do give warnings on the second test because __STDC__
is undefined. Avoiding these, if necessary, does add some complication; but
I firmly believe the first distinction is the more important, and should be
kept simple.
Gregg Townsend / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721
+1 602 621 4325 gmt at Arizona.EDU 110 57 16 W / 32 13 45 N / +758m
More information about the Comp.std.c
mailing list