Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-09-09 07:48:39


FWIW, I agree with Peter here. It sometimes makes sense to implement
undefined behavior in terms of throw(), but how can it make sense to
implement defined behavior (which in this case doesn't include abort()), in
terms of assert (which could abort())?

-Dave

----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, September 09, 2001 7:54 AM
Subject: Re: [boost] Re: thread lib review

> From: <williamkempf_at_[hidden]>
> > 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.
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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