From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-09-09 06:54:09
> When debugging you want the trap to occur as close to the error as
> possible, which is what asserts are good at. With an exception the
> debugger will trap several levels down from where the error actually
> occured, possibly even further down than a debugger allows you to
> traverse back up the stack with. Also, many (most?) debuggers allow
> you to step over the assertion, which would allow you to debug your
> exception trapping code. To my mind asserts are for debugging and
> exceptions are for error handling.
The rationale is sound, but the result does not conform to your
specification. The documentation doesn't state anywhere that a method
asserts; it says that the method throws on error.
Besides, most debuggers can trap exceptions at the time they are thrown.
'assert' should be reserved for undefined behavior detection.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk