This is the mail archive of the
mailing list for the libstdc++ project.
Re: [v3] more istream::ignore cleanups
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 04 Jan 2005 00:10:20 +0100
- Subject: Re: [v3] more istream::ignore cleanups
- References: <firstname.lastname@example.org>
Benjamin Kosnik wrote:
Yo Paolo, happy new year.Hey, you want to undo an effort of a few days!!!
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?
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...