From owner-freebsd-hackers Thu May 4 11:18:32 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id LAA18524 for hackers-outgoing; Thu, 4 May 1995 11:18:32 -0700 Received: from cs.weber.edu (cs.weber.edu [137.190.16.16]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id LAA18518 for ; Thu, 4 May 1995 11:18:31 -0700 Received: by cs.weber.edu (4.1/SMI-4.1.1) id AA08724; Thu, 4 May 95 12:09:36 MDT From: terry@cs.weber.edu (Terry Lambert) Message-Id: <9505041809.AA08724@cs.weber.edu> Subject: Re: GNU cpp bug with pthreads To: bde@zeta.org.au (Bruce Evans) Date: Thu, 4 May 95 12:09:36 MDT Cc: joerg_wunsch@uriah.heep.sax.de, patl@asimov.lashley.slip.netcom.com, rpt@miles.sso.loral.com, hackers@FreeBSD.org In-Reply-To: <199505040229.MAA30923@godzilla.zeta.org.au> from "Bruce Evans" at May 4, 95 12:29:04 pm X-Mailer: ELM [version 2.4dev PL52] Sender: hackers-owner@FreeBSD.org Precedence: bulk > >Actually, if you really want to be safe, it should be: > > > #if defined(__STDC__) && (__STDC__ == 1) > > Nope. There are probably more compilers that don't support && than > ones that don't default all undefined variables to 0. > > >There is (or was) at least one non-conforming compiler that set > >__STDC__ to 2. (And at least one that would complain if you > >tried '(__STDC__ == 1)' when __STDC__ hasn't been set at all...) > > It's very non-conforming :-). It's AIX in fasciest mode (where it requires functions be written with enbedded prototypes in the formal declaration), from what I remember. The ugly way to handle the whole thing is: #ifdef __STDC__ /* can't compare '#define x' with '#define x 1'*/ #if __STDC__ > 0 #define IS_ANSI 1 #endif /* __STDC__ > 0*/ #endif /* __STDC__*/ #ifdef IS_ANSI /* ANSI stuff*/ #else /* !IS_ANSI*/ /* non-ANSI stuff*/ #endif /* !IS_ANSI*/ Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.