Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2001 21:56:58 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Mike Barcroft <mike@FreeBSD.org>
Cc:        Wes Peters <wes@softweyr.com>, Bruce Evans <bde@FreeBSD.org>, <standards@FreeBSD.org>
Subject:   Re: cvs commit: src/include string.h
Message-ID:  <20011129213259.D1261-100000@gamplex.bde.org>
In-Reply-To: <20011129041735.F15672@espresso.q9media.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Nov 2001, Mike Barcroft wrote:

[moving declaration of strerror_r() to the "nonsstandard" section]
> As Bruce's commit message suggests, this is only temporary.  I think
> we need something along the lines of:
>
> #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
> #if _POSIX_C_SOURCE >= 200111L /* XXX */
> ...
> #endif
> #endif
>
> ...to properly protect new POSIX functions.  Broken down, this means
> something like "only prototype this function if we aren't using C90,
> POSIX.1, POSIX.1-88, POSIX.1-90, or POSIX.1-96".  I'm unsure whether
> we care if POSIX.1-200x functions leak into C99.

I care a bit.

The above ifdef should probably be changed to something like

#if _POSIX_VISIBLE >= 200111
...
#endif

where _POSIX_VISIBLE is define according to the settings of _POSIX_C_SOURCE,
_ANSI_SOURCE, _POSIX_SOURCE and other "feature test" (enable, disable,
or actually test) macros.  See wollman's old patches.

Note that it is the application's responsibility to set _POSIX_C_SOURCE.
Setting it is supposed to give precisely the interfaces specified by
the POSIX standard of the given data, modulo other feature test mac(this
is usually a restriction).  Not setting it should give everything if
no other feature disable macros are set.

There is no standard macro like _POSIX_C_SOURCE for C99.  We would need
a new macro like _ANSI_SOURCE to support restriction to C99 features.
Name it something like _C99_SOURCE (it's hard to think of a name as
non-descriptive as _ANSI_SOURCE).

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011129213259.D1261-100000>