[PATCH] Fix initialization of _M_grouping
Paolo Carlini
pcarlini@unitus.it
Tue Jan 29 16:00:00 GMT 2002
Benjamin Kosnik wrote:
> > I see. This currently fails for me.
>
> Ditto. I'm not quite sure how it's supposed to work, and if this is an
> accurate representation of what Nathan is talking about. I'm hoping he
> can yay or nay on it: Nathan?
Yes, I agree that it would be nice if Nathan could express his authotitative opinion
on what he would like to see worked out as soon as possible.
What I mean is this (admittedly, very naively): it is *really* important to allow
'\0' (or whichever control char, for that matter) as a legal thousands separator
(when groupings is in fact != "" of course, otherwise no problem at all, right?) ??
As far as named locales are concerned, for sure, with the simple patch for the
_M_grouping we have cooked up, _M_grouping is restored to a meaningful value ("",
that is) but _M_thousands_sep remains '\0', the value returned by glibc.
This should be ok for outputs (if I understand well) but not ok for parsing any
following input stream *if* the user modifies _M_grouping to something != "".
Perhaps Nathan implied that the user is supposed to *simultaneously* give a
"reasonable" value to _M_thousands_sep ?
> It is a pretty interesting testcase to play around with, even though this
> is really a side issue to the whole grouping/sep issue.
>
> I suspect the core that happens is when __sep == '0', not '\0'. Both
> cases should be fixed, but again, I'm not in a position to work on this
> right now.
>
> > This is really, I believe, a related but
> > different issue: making sure that everything works ok even for '\0' as the
> > thousands separator.
>
> Yes. From my limited time last night, it looks like std::string is all
> right but that other things go wrong where the following '0' after the
> '\0' gets eaten, so that l == 12345 and l != 1023045. This is a bug I think.
>
> > Please keep me updated: if you want me to help on auditing the library for this
> > or whatever.
>
> It would be great if you would figure out what is going on in this testcase.
Ok. I will try to do my best in the nest days, in the time allowed by my work.
Cheers,
Paolo.
More information about the Libstdc++
mailing list