scope() statements and return
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Tue Oct 7 07:34:12 PDT 2014
On 10/07/2014 04:23 PM, ketmar via Digitalmars-d wrote:
> On Tue, 07 Oct 2014 16:08:33 +0200
> Timon Gehr via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>
>>>> What's the point anyway?
>>> non-final try/catch will not make function "nothrow".
import core.exception;
void doStuff(){ }
void main() nothrow{
try{ doStuff(); }
catch(UnicodeException){ }
}
Error: function D main 'main' is nothrow yet may throw
> i'm talking about my proposal, where non-final try/catch will not make
> function nothrow, only 'final try' will do.
I.e. additional annotation overhead without a point?
> and anything that not
> catched in this 'final' will abort the program immediately, without any
> tries to do unwinding or executing scope() statements.
>
import core.stdc.stdlib;
void doStuff(){ throw new Exception(""); }
void main() nothrow{
scope(exit) assert(0);
try{ doStuff(); }
catch(Exception){ exit(2); }
}
More information about the Digitalmars-d
mailing list