Web lists-archives.com

Re: [Mingw-users] _XOPEN_SOURCE

On 4/21/2017 11:32 AM, Keith Marshall wrote:
> On 21/04/17 15:12, Earnie wrote:
>> On 4/20/2017 11:32 AM, Bryan Henderson wrote:
>>> Keith Marshall, in a recent thread:
>>>>  in _every_ case, the application is _required_ to specify the 
>>>>  _XOPEN_SOURCE value for which conformance is desired.
>>> Why do you say that?  Common sense, or did you see it written
>>> somewhere?
>>> And what do you make of the fact that every other X/Open-capable
>>> C library explicitly recognizes _XOPEN_SOURCE = null string as
>>> meaning "source code expects C library to conform to the original
>>> X/Open standard?
>> This reference [1] supports Bryan's assertion.
>> [1] http://man7.org/linux/man-pages/man7/feature_test_macros.7.html
> Yet, the example it cites requires a definition _with_ a value, (and 
> moreover, a non-zero value); when preceded by:
> #define _XOPEN_SOURCE  /* no value */
> GCC will complain:
> bar.c:2:19: error: operator '&&' has no left operand
>                    ^

So that documentation is somewhat off as defining _XOPEN_SOURCE without
a value could never be tested that way without an issue.  However, here
is another reference [2] indicating that _XOPEN_SOURCE may be defined
without a value prior to version 500.

This reference [3] indicates that _XOPEN_SOURCE should contain a value.
So prior to SUSv3 it appears to be up in the air as to how the constant
should be used; with versus without a value.

Given that GCC itself doesn't manage without a value I would suggest
that the correct fix is to assign a value.  The user will get further
with defining a value since there appears to be precedence for such
definition from the compiler authors.

[2] http://docs.oracle.com/cd/E19253-01/816-5175/standards-5/index.html


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
MinGW-users mailing list

This list observes the Etiquette found at 
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe