Howland Craig D (Craig)
Wed Mar 17 16:35:00 GMT 2010

Corinna wrote Wednesday, March 17, 2010 8:33 AM
> Subject: Re: Use of _XOPEN_SOURCE?
> I don't know either, but, here's a question.  What about values
> 500 and 600 or between 600 and 700?  Shouldn't the code be more
> forgiving, like this:
>   #if (_XOPEN_SOURCE - 0) >= 700        /* POSIX.1-2008 */
>     #define _POSIX_C_SOURCE       200809L
>    #elif (_XOPEN_SOURCE - 0) >= 600     /* POSIX.1-2001 or 2004 */
>     #define _POSIX_C_SOURCE       200112L
>    #elif (_XOPEN_SOURCE - 0) >= 500     /* POSIX.1-1995 */
>     #define _POSIX_C_SOURCE       199506L
>    #else
>     #define _POSIX_C_SOURCE       2
>   #endif
I purposely made it exact because as far as I read directly from the
standards, POSIX requires those exact values for _XOPEN_SOURCE;  if
another value is given for _XOPEN_SOURCE, there is not a pre-determined
value of _POSIX_C_SOURCE to assign.  GLIBC does a < 600 thing, but
they're taking a liberty not granted by POSIX.
     My proposal does have one "forgiving" feature, put in for the older
stuff before POSIX began the present method of exact values for
_XOPEN_SOURCE and replaced the orignal fuzzy _POSIX_SOURCE with
   #elif (_XOPEN_SOURCE - 0) < 500      /* really old */
    #define _POSIX_C_SOURCE       2
(The value of 2 does not have the same amount of specificity that the
year/month values do.)
     So, I still think that we should do it as I submitted.  If we
were to do differently, to be a little more forgiving, I propose that
it should purposely avoid values > 700.  If and when POSIX puts put
a new release, we can add the proper value at that time.  (Presumably,
they'll require 800 for their next release.)

More information about the Newlib mailing list