DIP60: @nogc attribute

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 16 12:53:00 PDT 2014


Peter Alexander:

> * Does @nogc => nothrow? If I'm not mistaken, throw must 
> through a GC-allocated Throwable.
>
> * If the above is true, does that mean exceptions cannot be 
> used at all in @nogc code?

This should work:

void foo() @nogc nothrow {
     static const err = new Error("error");
     throw err;
}

Bye,
bearophile


More information about the Digitalmars-d mailing list