From: Dirk Gerrits (dirk_at_[hidden])
Date: 2002-10-28 06:58:19
Noah Stein wrote:
> I would expect as you believe, too, that post conditions are likely to
> when exceptions are thrown. A post condition of push_back() should be
> the size of the container is one more than when the function was entered.
> As such, an out-of-memory exception will easily lead to a failure of
> I do however think that invariants should be checked when exceptions are
> thrown. After all, invariants should always be true.
Good points. Perhaps there should be two functions to check
postconditions. One in case of an exception, one without. That would be
easy to implement, but what if a range of exceptions can be thrown and
the postconditions are different in each case? A try catch block with
different post condition checks in each catch?
I'm beginning to believe that this is alot harder than I first thought. ;)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk