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

>| 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...
>I think it is written somewhere in the rules that max() morally
>corresponds to unbounded ignore, unless the stream is corrupted or EOF
>is reached.

Ah ha. Thanks Gaby for the key bit. Serves me right for thinking it was
simple and not looking though the archives... I can see why Paolo was so
exclamatory now! 

It looks like, in these situations, _M_gcount should be set to
numeric_limits::max() here. Ie, in the LFS case, say delim is at max +
5, _M_gcount will not be set correctly (ie, not max().)

>| If you want, I can add comments...
>That would be most welcome.  Thanks!

...yes, please do. I see a couple previous requests for this as well as
something that fails, test-wise, in the archives. Hopefully something
along these lines will prevent others from going at this half-baked as

best, benjamin

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