Hello Jörg et al,
# Just for grins, i dug out my old CP/M C compiler. (SuperSoft C, 1983
# vintage) That one's the only one so far i've seen where
# #if __STDC__
# wouldn't work as expected -- but
# #if (__STDC__ - 1) == 0
# wouldn't either. Apparently, this compiler substituted a `1' for any
# undefined identifier.
This contradicts the then unknown C89 Standard, which requires all
remaining identifiers to be replaced with the pp-number 0.
Here we have an example of why standardization can be a Good Thing :-)
# #ifdef __STDC__
# works there as well. Since this seems to be consensus for many other
# header files (Sun and HP, too), and is completely standards-compliant
# (the standard mandates that this macro is predefined to 1 on a
# conformant implementation
This is correct.
# and undefined otherwise -- Jens, is this
The "undefined otherwise" is merely wishful thinking, because the
Standard can't say anything about implementations that don't claim
conformance. So in theory there is nothing you can do if an uncompliant
implementations defines __STDC__ to any sequence of pp-tokens.
C99 6.10.8 says:
__STDC__ The integer constant 1, intended to indicate a conforming
# i'd vote for using that one.
As I understand it, the only problem is if some implementation indicates
non-conformance with #define __STDC__ 0, which is unheard of to me, and,
if I were an implementor of such a system, I'd just leave it undefined.
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message