Is "Out of Memory" a recoverable error?

Christopher Wright dhasenan at gmail.com
Thu Dec 4 15:17:49 PST 2008


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.



More information about the Digitalmars-d mailing list