This is the mail archive of the libstdc++@gcc.gnu.org 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: How do I select a version of libstdc+ to link against?


> And if you want to detect a failure to read a boolean (rather than simply EOF)
> follow the loop with:
>        if (!iss.eof())
>            cout << "fail" << endl;
> 
> That should give the same behaviour with 4.1 and 4.4 for your test, and for
> the case where the stream fails because it contains a non-boolean value such
> as "true true x" or "true true fal"
> 
> Testing !iss.eof() tells you that the loop exited for some reason other than
> reaching EOF, i.e. it couldn't convert the input to bool.

I'm sorry, but that is just giving the same problem as before.  In the case that the input stream contains valid Booleans, after the last Boolean is read, eof() is not true.  My understanding of the bug report that I referred to earlier, is that one must attempt to read past the end of the stream for eof() to return true, which won't happen in the normal case.


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