This is the mail archive of the mailing list for the libstdc++ 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] more istream::ignore cleanups

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...


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