From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-04-17 18:44:26
At 8:43 PM +0200 4/17/01, Jens Maurer wrote:
>> If an exception is thrown the postcondition is almost gauranteed to
>> fail. As for single entry/single exit functions... they're needed
>> for checking postconditions, not for checking invariants. However,
>> it would be nice if some mechanism could be devised that would allow
>> postconditions to work regardless of the number of exit points.
>It seems to me that you want to find out in your "postcondition
>checking destructor" whether it was invoked because an exception was
>thrown (and stack unwinding is happening) or because the scope
>(function) was exited by normal means (i.e. return).
>The C++ standard provides the function std::uncaught_exception()
>which is true if your destructor is called during stack unwinding
>and false otherwise. See section 18.6.4 in the C++ standard.
>Note that this feature is said not to work reliably on some
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?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk