Date: Sun, 11 Jan 2004 02:03:50 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Stefan Farfeleder <stefan@fafoe.narf.at> Cc: freebsd-standards@freebsd.org Subject: Re: Fwd: Re: ports/52016: New port: lang/harbour -AClipper-compatible compiler Message-ID: <20040111014013.I22846@gamplex.bde.org> In-Reply-To: <20040109164241.GA596@wombat.fafoe.narf.at> References: <200401081510.39015.linimon@lonesome.com> <20040110012527.S18300@gamplex.bde.org> <20040109164241.GA596@wombat.fafoe.narf.at>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 9 Jan 2004, Stefan Farfeleder wrote: > On Sat, Jan 10, 2004 at 02:03:57AM +1100, Bruce Evans wrote: > > > - at least old standards seem to permit feature test macros to have no > > value (they may be empty, or perhaps more bizarre). The "+ 0" in the > > above is to handle this case, so that feature test with an empty value > > work the same as ones with value 0. > > [...] > > > #if _POSIX_SYNCHRONIZED_IO + 0 > 0 > > Undefined identifiers are replaced with 0 in a #if directive. Maybe > some ancient pre-C90 compilers didn't do that, but I think they can be > ignored these days. I know :-), and consider it a style bug to not depend on this feature, but the above is to handle the case where _POSIX_SYNCHRONIZED_IO is defined to be <nothing>. Then "_POSIX_SYNCHRONIZED_IO > 0" would expand to " > 0", which is a syntax error. I think this possibility is fixed in POSIX.1-2001. It clearly says that the feature test constants "shall be defined with a value" if they are defined at all. POSIX.1-1990 seems to only say what happens if they are defined with a value or are undefined, leaving open the possibility that they are defined to a non-value. Hmm, POSIX.1-2001 doesn't seem to require the value to be integral, except tacitly since they would not be usable in cpp expressions if they were floating point. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040111014013.I22846>