Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Nov 2001 14:52:22 +0100
From:      Jens Schweikhardt <schweikh@schweikhardt.net>
To:        Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
Cc:        Cyrille Lefevre <clefevre@citeweb.net>, Warner Losh <imp@harmony.village.org>, schweikh@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: malloc.h
Message-ID:  <20011110145222.A942@schweikhardt.net>
In-Reply-To: <20011108225915.A75044@uriah.heep.sax.de>; from j@uriah.heep.sax.de on Thu, Nov 08, 2001 at 10:59:15PM %2B0100
References:  <200111080839.fA88dv740802@harmony.village.org> <200111080950.fA89oIk21059@gits.dyndns.org> <20011108225915.A75044@uriah.heep.sax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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
# OK?),

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
          implementation.

# i'd vote for using that one.

<AOL>
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.

Regards,

	Jens
-- 
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011110145222.A942>