libstdc++/10093: Regression: Setting failbit in exceptions doesn't work

Pétur Runólfsson peturr02@ru.is
Thu Apr 3 15:20:00 GMT 2003


Jerry Quinn wrote:
> The bug filed was about the fact that if ios::failbit is set in the
> exception mask and we throw an error, it doesn't get rethrown.  So the
> question is what other conditions should result in rethrowing the
> exception.

I don't think there is any question about that; caught exceptions
get rethrown if and only if (exceptions() & badbit) (for most
functions).

> Also, are you and Petur saying that we should just have a catch() that
> catches everything?  I guess we then use rtti before deciding if it of
> class exception and whether to rethrow or not.

I don't think the behaviour should depend in any way on the type
of the exception; that is, the catch block should be "as if":

try {
// Some stuff
} catch (...) {
  try { setstate(badbit); } catch (...) { }
  if (exceptions() & badbit) throw;
}

The question (as I see it) is what goes in the try block; opinions
seem to differ.

At this point, I think the best strategy is to wait a couple of
weeks and see any of the relevant defect reports get resolved.

Regards,
Petur



More information about the Libstdc++ mailing list