View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000702 | 1003.1(2013)/Issue7+TC1 | System Interfaces | public | 2013-05-22 06:01 | 2013-05-23 16:01 |
Reporter | mdempsky | Assigned To | |||
Priority | normal | Severity | Editorial | Type | Clarification Requested |
Status | Closed | Resolution | Withdrawn | ||
Name | Matthew Dempsky | ||||
Organization | OpenBSD | ||||
User Reference | |||||
Section | newlocale | ||||
Page Number | |||||
Line Number | |||||
Interp Status | --- | ||||
Final Accepted Text | |||||
Summary | 0000702: Clarify newlocale(LC_CTYPE_MASK, "loc1", 0) | ||||
Description | In the informative examples section for newlocale(), there's an example invocation of newlocale(LC_CTYPE_MASK, "loc1", 0). POSIX says that newlocale(LC_CTYPE_MASK, "loc1", 0) should allocate a new locale object because the base argument is (locale_t)0, but it doesn't indicate what should be done about the resulting locale_t's non-LC_CTYPE locale categories. E.g., what's the behavior of strcoll_l(s1, s2, newlocale(LC_CTYPE_MASK, "loc1", 0)) since the returned locale_t doesn't appear to have a specified collation locale? I see a few possible solutions: 1. Don't specify anything; it's implicitly undefined behavior if anything subsequently depends on the returned locale_t's non-LC_CTYPE categories. 2. Specify that when (locale_t)0 is used, the newly allocated locale object defaults to the C/POSIX locale. 3. Specify that when (locale_t)0 is used, the newly allocated locale object defaults to the calling thread's thread-local locale or the global locale if the calling thread doesn't have a thread-local locale. I think eglibc uses option #2, while FreeBSD and NetBSD appear to use option #3. (However, neither of FreeBSD/NetBSD's newlocale()s are POSIX compliant anyway because they allocate and return a new locale_t object but then don't free the base locale_t.) http://www.eglibc.org/cgi-bin/viewvc.cgi/trunk/libc/locale/newlocale.c?revision=22177&view=markup http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/locale/newlocale.c?rev=1.2&content-type=text/x-cvsweb-markup&only_with_tag=MAIN http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/locale/xlocale.c?rev=1.6 | ||||
Desired Action | Specify the default locale category properties for a locale_t allocated with newlocale(LC_CTYPE_MASK, "loc1", 0) and generically for all other possible mask values. | ||||
Tags | No tags attached. |
|
Actually, upon further review, I think FreeBSD also follows option #2. |
|
The end of the third paragraph of the description states: "If a completely new locale object is created, the data for all sections not requested by category_mask shall be taken from the default locale." |
|
D'oh, thanks Geoff, I missed that somehow. No further action needed then. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-05-22 06:01 | mdempsky | New Issue | |
2013-05-22 06:01 | mdempsky | Name | => Matthew Dempsky |
2013-05-22 06:01 | mdempsky | Organization | => OpenBSD |
2013-05-22 06:01 | mdempsky | Section | => newlocale |
2013-05-22 06:28 | mdempsky | Note Added: 0001620 | |
2013-05-22 08:23 | geoffclare | Note Added: 0001621 | |
2013-05-22 17:18 | mdempsky | Note Added: 0001622 | |
2013-05-23 16:01 | msbrown | Interp Status | => --- |
2013-05-23 16:01 | msbrown | Status | New => Closed |
2013-05-23 16:01 | msbrown | Resolution | Open => Withdrawn |