Erik Wikström wrote:
>
>> Based on this, I assume that fail() checks failbit only. So is this
>> TC++PL3 errata or something?
>
> Nope, it is just you interpretation that is wrong. Note the word *also*,
> which says that the failbit can be set without badbit, but tells us
> nothing about the reverse.
OK, thanks for the clarification.
In this way, checking an istream in the style "while(cin)" is equivalent
to "while(cin.rdstate() ^ istream::badbit || cin.rdstate() ^
istream::failbit)", that is if both are inactive.
It is more broad than Alf said.