[Patch] Fix libstdc++/9533
Paolo Carlini
pcarlini@unitus.it
Tue Mar 4 14:21:00 GMT 2003
Nathan Myers wrote:
>>Another observation which comes to my mind: that this approach is
>>really low level wrt the underflow (hack, indeed) can be seen clearly
>>from the fact that in this way we get the size in bytes, not the
>>number of chars in the internal representation.
>>Therefore, it seems to me, showmanyc will have to use also the
>>codecvt information.
>>
>>
>No. If there is a codecvt<> involved (is there? I didn't look,
>I thought that was a filebuf<> thing) then showmanyc() should divide
>the number of bytes by the maximum character size,
>std::codecvt<>::max_length(). Remember it's returning an estimate,
>a lower bound, and shouldn't be doing too much work.
>
That's the key point, thanks!
Just a lower bound, so max_length() suffices and we are done once and
for all even for
encodings -1 (not yet implemented) and 0 (partially so).
Paolo.
More information about the Libstdc++
mailing list