Boost logo

Boost :

From: Jesse Jones (jejones_at_[hidden])
Date: 2001-03-19 22:57:18

>Yes, but how do you document a function's behavior?
>"may throw an exception due to low memory or insufficient resources, or if
>the user passes an invalid object. In the latter case there is no guarantee
>that the operand is left in a consistent or even destructible state"

You don't. All that you can say is that these sort of violations result in
undefined behavior. If some client elects to throw an exception it should
be clear to him that objects may be left in a bad state. I would tend to
think aborting with an option for saving the user's data in a new file
would be a better option in release builds, but I'm not sure you can say
that no one should ever throw exceptions if an assert fails.

>I believe in simple contracts, guarantees, and invariants. Simple this aint.

Design by Contract. I like it :-). It seems pretty simple to me...

  -- Jesse

Boost list run by bdawes at, gregod at, cpdaniel at, john at