From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-04-12 17:27:26
At 6:44 PM +0300 4/12/01, Peter Dimov wrote:
>The options for the documented interface of a function, as I see them, are:
> f() throws if X;
> f() calls precondition_violation if X;
> the behavior of f() is undefined if X.
>Having precondition_violation won't make the question of choosing among the
>three magically go away, however. :-)
>Note that I think that  should work the same in debug or release builds,
>with the possible exception that the default handler may do different
>things. The check should not disappear.
If I understand you correctly you're saying that the code should
evaluate a predicate and call a function which will dispatch to some
handler if the predicate is false. And the function call will always
be made, although the handler may be nil.
Would you do the same with post-conditions? With invariants? What if
a check isn't constant time?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk