This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Fix initialization of _M_grouping
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Nathan Myers <ncm-nospam at cantrip dot org>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 29 Jan 2002 09:35:03 +0100
- Subject: Re: [PATCH] Fix initialization of _M_grouping
- References: <3C55D6DD.D9B0E463@unitus.it> <20020128235014.C80012@cantrip.org>
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.