[PATCH] Fix initialization of _M_grouping
Paolo Carlini
pcarlini@unitus.it
Tue Jan 29 00:34:00 GMT 2002
Nathan Myers wrote:
>On Mon, Jan 28, 2002 at 11:55:25PM +0100, Paolo Carlini wrote:
>
>>this is the patch I have prepared, and already tested positively with
>>libstdc++/5280 testcase. I'm currently retesting it with a new additional
>>testcase. ...
>> _M_thousands_sep = *(__nl_langinfo_l(THOUSEP, __cloc));
>>- _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
>>+ // Check for NUL, which implies no grouping.
>>+ if (_M_thousands_sep == '\0')
>>+ _M_grouping = "";
>>+ else
>>+ _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
>>...
>>- _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
>>+ if (_M_thousands_sep == L'\0')
>>+ _M_grouping = "";
>>+ else
>>+ _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
>>...
>>+ VERIFY( th == '\0' );
>>+ VERIFY( g == "" );
>>
>
>I'm having second thoughts about this. It seems OK for the locale
>file to have an empty string, and for the C++ locale thousands_sep()
>to return a NUL. It means that if a user derives from
>std::numpunct_byname<char>, and supplies a non-empty grouping, then
>num_put<> should just use the NUL as a group separator. If they care,
>they should override both members.
>
Nathan, may I consider this comment of yours as a permission to commit?
Do you agree with me that indeed it is better not to test for th == '\0'
? Please let me know your opinion on this, albeit minor, issue.
Thanks,
Paolo.
More information about the Libstdc++
mailing list