[v3] more istream::ignore cleanups
Paolo Carlini
pcarlini@suse.de
Mon Jan 3 23:08:00 GMT 2005
Benjamin Kosnik wrote:
>Yo Paolo, happy new year.
>
>I think you can be a bit more aggressive about the istream::ignore
>cleanups. Let me know what you think of the following patch.
>
>Also, I am mystified by:
>
> if (__n == numeric_limits<streamsize>::max()
> && !traits_type::eq_int_type(__c, __eof)
> && !traits_type::eq_int_type(__c, __delim))
> _M_gcount = numeric_limits<streamsize>::min();
>
>this resetting of _M_gcount. Any chance you can explain?
>
>
Hey, you want to undo an effort of a few days!!!
Of course I can explain!
The problem is, on 32-bit machines, LFS enabled, your file can be bigger
that 2G, thus more than 2G chars to ignore, in general, whereas
streamsize, being basically a ptrdiff_t, is still limited to 32-bit: we
are at risk of *signed* integer overflow, which is absolutely
verboten!!! Still, we want to allow the user to keep on using ignore, in
the general, unlimited form, also on such platforms...
If you want, I can add comments...
Paolo.
More information about the Libstdc++
mailing list