Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-08 13:49:00


Alexander Terekhov wrote:
> Peter Dimov wrote:
>>
>> This doesn't play well with exception specifications since,
>
> Those are pretty much broken anyway.
>
>
http://groups.google.com/groups?selm=m.collett-E982F8.12450216072002%40lust.ihug.co.nz
> http://groups.google.com/groups?threadm=3D3547BE.3045A2A6%40web.de
> (Subject: Re: Is internal catch-clause rethrow standard?)
>
>> if I understand
>> them correctly, (and I have no reason to, since I've never used one
>> or seen one used,) a violated exception specification is required to
unwind,
>> _then_ call unexpected(), which can then rethrow a different,
"conforming",
>> exception.
>
> That needs some fixing, right. std::unexpected() shall be invoked at
> throw point (as kinda "side effect" of throw-expression).

Consider:

void f() throw(X); // calls g
void g() throw(Y); // calls h
void h() throw(Z); // throws Z();

The Z exception hits the throw(Y) wall; unexpected() eats the Z and throws
Y. Y hits throw(X), unexpected() now throws a X.

If you invoke unexpected() before the unwinding, there is no way you can get
an exception to escape through the three ex.specs.


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