`newlocale ()' clarifications

Ludovic Courtès ludo@chbouib.org
Fri Jan 12 17:02:00 GMT 2007


Hi,

Roland McGrath <roland@redhat.com> writes:

>>  3. Drepper's proposal [0] and the draft both say that, when BASE is
>>     NULL, "the data for all sections not requested by CATEGORY_MASK
>>     shall be taken from the default locale."  Here, "default locale"
>>     really means "C locale" (at least, that's what glibc does).
>> 
>>     This contrasts with Darwin's manpage which reads: "If BASE is NULL,
>>     the current locale is used."  This is not compatible with the draft
>>     specs.
>
> Indeed.  If the spec is not already unambiguous on what "default locale"
> means, then we should make it so or make it use a clearer term in the
> description of newlocale.

Agreed.  Are you in a position to influence the spec?

> I think you can use newlocale (LC_ALL_MASK, setlocale (LC_ALL, NULL), NULL).
> I don't see why that wouldn't work, and portably.

Right, although it is IMO less elegant than using `LC_GLOBAL_LOCALE' and
actually requires two `newlocale ()' calls (one to get a `locale_t' for
the current locale and a second one to use it as BASE).

Thanks,
Ludovic.



More information about the Libc-alpha mailing list