Want the word on __STDC__
Lars Wirzenius
wirzenius at cc.helsinki.fi
Tue Mar 12 02:01:27 AEST 1991
In article <lampblack at dce.ie>, em at 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 <limits.h> (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 at cc.helsinki.fi
More information about the Comp.std.c
mailing list