Walter Bright wrote:
nothrow void foo();

void bar()
{
    try
    {
    foo();
    }
    finally
    {
        will_never_execute(); // even if foo() throws
    }
}

because the compiler will optimize away the finally clause.

! ! !

Surely you mean "catch" rather than "finally"? I should hope that the code you have there is equivalent to:

void bar()
{
        foo();
        will_never_execute();
}

Otherwise you'd break calling code by switching a function to nothrow.

Reply via email to