Boost logo

Boost :

Subject: Re: [boost] The noexcept Specifier & Block
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2009-04-16 16:50:20


Alexander Terekhov wrote:
> http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2855.html#noexcept
>
> I gather that
>
> noexcept void f() {
> throw 0;
> }
>
> is supposed to be ill-formed versus well-formed
>
> noexcept void f() {
> noexcept { throw 0; }
> }
>
> invoking undefined behaviour.
>
> Well, this is not helpful.
>
Yes it is. The noexcept block is the programmer's way of telling the
compiler, "Trust me, I know what I'm doing." If the programmer doesn't,
that's not the compiler's fault.
> Both forms shall be well-formed with defined behaviour: invocation of
> unexpected() at throw point.
>
We don't need noexcept for that; that's what an empty throw declaration
does.

Sebastian


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