Date: Thu, 4 May 95 12:09:36 MDT From: terry@cs.weber.edu (Terry Lambert) To: bde@zeta.org.au (Bruce Evans) Cc: joerg_wunsch@uriah.heep.sax.de, patl@asimov.lashley.slip.netcom.com, rpt@miles.sso.loral.com, hackers@FreeBSD.org Subject: Re: GNU cpp bug with pthreads Message-ID: <9505041809.AA08724@cs.weber.edu> In-Reply-To: <199505040229.MAA30923@godzilla.zeta.org.au> from "Bruce Evans" at May 4, 95 12:29:04 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> >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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9505041809.AA08724>