$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-18 06:42:53
----- Original Message -----
From: "Jesse Jones" <jesjones_at_[hidden]>
> I thought std::uncaught_exception() was pretty much worthless, but I
> confess I don't know all the details (and the archives don't have
> much to say). Can we really use this inside a dtor to see if the
> stack is being unwound because of an exception?
Yes (if the compiler conforms). The problem with uncaught_exception() is
that it won't detect the case where you're inside a catch block which is
going to rethrow the exception:
try {
}
catch(...) {
// cleanup actions...
// <=== uncaught_exception() is false here
// more cleanup actions...
throw;
}
This condition is almost the moral equivalent of being inside a destructor
during stack unwinding: the supposedly neccessary "more cleanup actions"
won't be executed if you rethrow here. Also, the active exception is lost.
-Dave