[Patch] Fix the narrow/widen problem in money_get::do_get
Martin Sebor
sebor@roguewave.com
Mon Mar 1 16:58:00 GMT 2004
Paolo Carlini wrote:
> Martin Sebor wrote:
>
>> More importantly, do you know of any locales where there
>> are two or more characters that ctype narrows to the same digit?
>
>
> See:
>
> http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#303
>
I assume you are referring to this:
"... in the Unicode representation of the Devanagari script
(used in many of the Indic languages) the digit 0 is 0x0966,
and the digit 1 is 0x0967. Calling narrow would translate
those into '0' and '1'.
Yes, that's the example I was trying to recall. Thanks for pointing
it out.
I don't think the example is terribly relevant anymore, though,
or that the text above is entirely correct. I'm not aware of any
requirement that says that any wide character with value greater
than 0xff must be successfully narrowed to anything at all (other
than the default). Even if narrow() did do that (it might or it
may not), I am not convinced that there would be anything wrong
with it. It might be helpful to do a survey of scanf() behavior
on a number of platforms to see what the C library implementors
consider appropriate.
Either way, though, unless someone can find a requirement that
narrow() must translate alternative digit representations to their
ASCII equivalents, I maintain that it makes no practical difference
whether narrow() or widen() is called by the implementation of the
get() functions.
Martin
More information about the Libstdc++
mailing list