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

next in thread | previous in thread | raw e-mail | index | archive | help
As Cyrille Lefevre wrote:

> the difference is that if __STDC__ isn't defined, #if (-0)==0
> continue to work.

Well, not really. :-)

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

#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 and undefined otherwise -- Jens, is this
OK?), i'd vote for using that one.

> IMHO, the correct statement is :
> 

[obfuscated cpp code contest candidate :-) removed]

> also, as I remember me, Solaris or HP uses the construction I post
> in they headers.

Well, no.  Solaris uses #if (__STDC__-1==0) only in connection with
other conditions in the same #if part.  Otherwise, they use a simple
#ifdef __STDC__ as well.

Anyway, i don't care much except that i'd like to see gcc -traditional
accept <malloc.h> since it used to be a legitimate header at its time.
Otherwise, we should ban the entire -traditional option as well (it
makes string literals writeable, and a few other things).

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

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?20011108225915.A75044>