Boost logo

Boost :

Subject: Re: [boost] The noexcept Specifier & Block
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-04-17 16:39:18


Alexander Terekhov:

> Avoiding unwinding for unexpected exceptions, for example.

The reason the standard specifies calling unexpected() at the exception spec
point is conceptually sound (but practically not that useful). Consider

void f()
{
    throw X();
}

void g() throw(Y)
{
    f();
}

void h() throw(Z)
{
    g();
}

If unexpected() is always invoked at the throw point, there is no way for an
exception to escape this call stack. If it's invoked at the exception
specification points, it can, in principle, first throw a Y, then a Z. The
primary purpose of unexpected(), as originally envisaged (I presume), is
exception translation.


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