Title
locale::name specification unclear — what is implementation-defined?
Status
c++17
Section
[locale.members]
Submitter
Richard Smith

Created on 2014-06-09.00:00:00 last changed 59 months ago

Messages

Date: 2016-08-05.03:58:49

Proposed resolution:

This wording is relative to N4606.

  1. Change [locale.members] as indicated:

    basic_string<char> name() const;
    

    -5- Returns: The name of *this, if it has one; otherwise, the string "*". If *this has a name, then locale(name().c_str()) is equivalent to *this. Details of the contents of the resulting string are otherwise implementation-defined.

Date: 2016-08-05.03:58:49

[ 2016-08 - Chicago ]

Thurs PM: Moved to Tentatively Ready

Date: 2016-08-03.00:00:00

[ 2016-08-03 Chicago LWG ]

Walter, Nevin, and Jason provide initial Proposed Resolution.

Date: 2014-06-09.20:14:57

[locale.members] p5 says:

Returns: The name of *this, if it has one; otherwise, the string "*". If *this has a name, then locale(name().c_str()) is equivalent to *this. Details of the contents of the resulting string are otherwise implementation-defined.

So… what is implementation-defined here, exactly? The first sentence completely defines the behavior of this function in all cases.

Also, the second sentence says (effectively) that all locales with the same name are equivalent: given L1 and L2 that have the same name N, they are both equivalent to locale(N), and since there is no definition of "equivalent" specific to locale, I assume it's the normal transitive equivalence property, which would imply that L1 is equivalent to L2. I'm not sure why this central fact is in the description of locale::name, nor why it's written in this roundabout way.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-05 03:58:49adminsetmessages: + msg8419
2016-08-05 03:58:49adminsetstatus: new -> ready
2016-08-04 18:28:00adminsetmessages: + msg8398
2016-08-04 18:28:00adminsetmessages: + msg8397
2014-06-09 00:00:00admincreate