Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-04-17 14:02:03


--- In boost_at_y..., Jens Maurer <Jens.Maurer_at_g...> wrote:
> williamkempf_at_h... 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.

That's the easiest of the problems to solve here ;).
 
> Note that this feature is said not to work reliably on some
> compilers.

Such as my least favorite compiler that I have to use... MSVC.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk