This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] FP printing, take 2


gp.bolton@computer.org (Gawain Bolton)  wrote on 31.08.04 in <4134DB04.4000809@computer.org>:

> Yes I have one comment...   Maybe question actually because I must
> admit, I don't know the first thing about the locale part of
> libstdc++!   The following lines strike me as odd:
>
> *__sbuf++ = __digits[*__buf++ - '0'];
>
>     *__tb-- = '0' + (__decp % 10);
>
> Here the implicit assumption seems to be that the character set used
> orders the digits in successive increasing order from '0' to '9', which
> is true of ASCII.
>
> Is this a valid assumption for the locale library?

I vaguely recall this being demanded by the C standard ... in any case,  
I'm pretty sure it is true of evry character set I ever saw. Most  
importantly, it is true for EBCDIC (digits are F0 .. F9) and of every set  
of decimal digits in Unicode - and of course for everything based on ASCII  
(such as the ISO8859 family).

(It really was not necessary to quote the whole fourty kilobytes patch!)

MfG Kai


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]