Web lists-archives.com

Re: [Mingw-users] _XOPEN_SOURCE




On 4/25/2017 8:20 PM, Bryan Henderson wrote:
>> "If defined (with any value)"
>>
>> If the author intended that an empty reference was valid he would not
>> have added "(with any value)".  
> 
> I don't know what you mean by empty reference, but
> 
>   #define ABC
> 
> defines a macro ABC with a value witch is zero characters.  It is common to

That is where you are incorrect.  Macro expansion expands this to no
value.  It is not the same as an empty string represented by "" which as
zero characters.

> refer to that entity as a value; every programming language I know that has
> a data type for text defines zero characters as one of its possible values.
> The author said "any value" to let you know that it doesn't matter what value
> the macro has, even the zero-character one.
> 

Any value is not to be construed to mean an empty definition which can
only be tested with the defined() macro function.  An empty definition
expands to nothing and constructs where a value is expected cannot be
properly compiled when the definition is empty.

> But again, if you think the author might have considered zero characters not
> to be a value, you have only to look at how he used the phrase "(with any
> value)" elsewhere on the same page to know that it didn't.
> 
> As you're probably aware, other feature test macros, such as _BSD_SOURCE never
> assigned any meaning to particular values, and therefore people essentially
> always define it as the zero-character value.  It's the most logical value to
> use when any value works.  And yet, this author said _BSD_SOURCE can have "any
> value".
> 

I caught this after I sent my previous email but did you read the the
first paragraph on the next page explaining that _XOPEN_SOURCE is
expected to have a value?  I'm not sure why the author decided to
convolute what he was describing by adding "(with any value)" to those
not requiring a value.  An empty definition isn't a value and can only
be used as a filter with the defined() macro function.

> This author knew that all C libraries at that time would accept any value,
> even the zero-character one, for _XOPEN_SOURCE too.

Again, a zero character value is not the same as an empty definition
where the expansion of a macro is nothing at all.

-- 
Earnie

------------------------------------------------------------------------------
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
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
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:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe