From owner-freebsd-current Thu Nov 8 1:50:25 2001 Delivered-To: freebsd-current@freebsd.org Received: from smtp.noos.fr (racine.noos.net [212.198.2.71]) by hub.freebsd.org (Postfix) with ESMTP id 8CC1637B417 for ; Thu, 8 Nov 2001 01:50:21 -0800 (PST) Received: (qmail 373854 invoked by uid 0); 8 Nov 2001 09:50:19 -0000 Received: from unknown (HELO gits.dyndns.org) ([212.198.229.145]) (envelope-sender ) by 212.198.2.71 (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 8 Nov 2001 09:50:19 -0000 Received: (from root@localhost) by gits.dyndns.org (8.11.6/8.11.6) id fA89oIk21059; Thu, 8 Nov 2001 10:50:18 +0100 (CET) (envelope-from root) Message-Id: <200111080950.fA89oIk21059@gits.dyndns.org> Subject: Re: malloc.h In-Reply-To: <200111080839.fA88dv740802@harmony.village.org> To: Warner Losh Date: Thu, 8 Nov 2001 10:50:18 +0100 (CET) Cc: Joerg Wunsch , freebsd-current@FreeBSD.ORG Reply-To: clefevre@citeweb.net From: Cyrille Lefevre Organization: ACME X-Face: X-Mailer: ELM [version 2.4ME+ PL95a (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Warner Losh wrote: > In message <20011108075021.P43204@uriah.heep.sax.de> Joerg Wunsch writes: > : > #if (__STDC__-0) == 0 > : > : What is the difference to my version (except that it would fail for > : __STDC__ being greater than 1)? I don't know how pre-ANSI cpps did > : behave, but at least a standard-conformant cpp must replace any > : identifier in an #if statement that remains after macro expansion by > : 0L. the difference is that if __STDC__ isn't defined, #if (-0)==0 continue to work. > It isn't different. Some people like to > #define TRUE (1 == 1) > too, which is bogus, imho. They like to trot out the fact that some > whacked out compiler from the 1980's or earlier defined TRUE to be 255 > or something like that. :-). > > I wouldn't worry about it > > #if __STDC__ > > is exactly right. I still remember me some compiler (cpp) which complain on such statement if the symbol is undefined and __STDC__ isn't always defined under some compiler (don't remember which). IMHO, the correct statement is : #ifdef __STDC__ #define GOODCPP #if __STDC__ #define ANSI #else #undef ANSI #endif #else #define WRONGCPP # cpp can't handle #x or x##x in macro #under ANSI #endif also, as I remember me, Solaris or HP uses the construction I post in they headers. > Older, pre ANSI cpp would treat this correctly, unless they were very > very very old and didn't have the #if directive, but only the #ifdef > directive. That's so old, I've never seen one, but rumors about their > existitance filled comp.lang.c in 1985-1989 when I still had time for > netnews. I'm sure I encountered this problem until 1995 at least. Cyrille. -- Cyrille Lefevre mailto:clefevre@citeweb.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message