Path: utzoo!attcan!uunet!husc6!mailrus!ncar!noao!arizona!gmt From: gmt@arizona.edu (Gregg Townsend) Newsgroups: comp.std.c Subject: A convention for defining __STDC__ Message-ID: <8821@megaron.arizona.edu> Date: 21 Jan 89 18:47:56 GMT References: <9422@smoke.BRL.MIL> <9445@smoke.BRL.MIL> <9436@smoke.BRL.MIL> <12570003@hpclsue.HP.COM> <915@sfmin.UUCP> Reply-To: gmt@arizona.edu (Gregg Townsend) Organization: U of Arizona CS Dept, Tucson Lines: 25 In article <915@sfmin.UUCP> dfp@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@Arizona.EDU 110 57 16 W / 32 13 45 N / +758m