From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-04-14 19:15:58
on 4/14/00 12:15 PM, Valentin Bonnard at Bonnard.V_at_[hidden] wrote:
> Dave Abrahams wrote:
>> OK, though I don't really think that carries much weight, since it doesn't
>> make any sense to have a throw from a destructor under current language
> Whether it is allowed or not by your personal coding
> conventions, it makes a lot of sens to throw in a dtor
I don't agree with that part. There are some edge cases, but in general it
doesn't make much sense, IMO.
> and never leads to undefined behaviour.
That part is true. The fact that there is no undefined behavior doesn't make
it a reasonable thing to do.
> (It's the same as throwing from a ctor, and carries the
Not quite. A ctor is never implicitly invoked by stack unwinding (it can
only happen if explicitly invoked in a dtor). It carries an attendent risk
of program termination not implied by a throw from a ctor.
> same myths and legends as throwing from a ctor used to
> carry some time ago.)
I don't think so. It's pretty easy to understand why throwing from a dtor is
dangerous. The myths about throwing from a ctor were based on lack of
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk