Fwd: Re: ports/52016: New port: lang/harbour -AClipper-compatible compiler

Bruce Evans bde at zeta.org.au
Sat Jan 10 07:04:18 PST 2004

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.


More information about the freebsd-standards mailing list