Boost logo

Boost :

Subject: Re: [boost] Question for C++ experts about exception allocation failure
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-05-17 14:24:26


AMDG

Adam Badura wrote:
> AFAIK this is not true. At a single execution point we might
> require space for only two exceptions (per thread). The one actually
> thrown and a second one in case we are in catch block and we construct
> a new exception. There is no such thing as current_exception in
> current Standard and the one implemented in Boost.Exception makes a
> (dynamically allocated) copy. How will current_exception be
> implemented in future C++ Standard implementation I don't know.
> More exceptions would be possible if if throwing an exception while
> an exception is already active would not terminate execution. The
> Standard might allow throwing a second exception unless it would lead
> to unwinding the same function for two exceptions at the same time.
> This way we could call to throwing functions in destructors if we just
> did not propagate exceptions from them. If I am not mistaken Standard
> does not allow it and terminates upon throw for a second time (I don't
> know why this is so). So I don't see way of achieving more then 2
> exception objects at the same time (per thread).

terminate will not be called unless the destructor exits with an exception.
You can have an arbitrary number of active exceptions.

In Christ,
Steven Watanabe


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