Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!fuug!news.funet.fi!hydra!cc.helsinki.fi!wirzenius From: wirzenius@cc.helsinki.fi (Lars Wirzenius) Newsgroups: comp.std.c Subject: Re: Want the word on __STDC__ Message-ID: <1991Mar11.160127.5496@cc.helsinki.fi> Date: 11 Mar 91 16:01:27 GMT References: <4203@lupine.NCD.COM> <15381@smoke.brl.mil> <668288453.3046@mindcraft.com> Organization: University of Helsinki Lines: 37 In article , em@dce.ie (Eamonn McManus) writes: > If I want my code to run on pre-standard implementations (which presumably > I do if I care about __STDC__) then I am reluctant to depend on > #if __STDC__ > or > #if __STDC__ == 1 > rather than > #ifdef __STDC__ > which would have been safe had it not been for cretinous implementors who > made half-standard implementations with __STDC__ defined but 0. How about: #ifndef STD_C # ifdef __STDC__ # if __STDC__ == 1 # define STD_C # endif # endif #endif and then code the rest of the program depending on STD_C instead of __STDC__? Incidentally, I would think that it would be better (or at least more useful) to use constants that describe characteristics of the system, rather than conformance to the standard. For example, I think prototypes are available in several non-standard (or almost standard) implementations, which don't do the Right Thing for __STDC__. Another example is header files. The standard introduces (doesn't it?), which may or may not be available in non-standard implementations. It might be a local enchancement to make standard conforming programs to compile a teeny bit easier, but might not be available on other sites with the same C implementation. -- Lars Wirzenius wirzenius@cc.helsinki.fi