I can has @nogc and throw Exceptions?

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 13 13:08:56 PST 2015


On Friday, 13 February 2015 at 19:09:43 UTC, Tobias Pankrath 
wrote:
> 1. Throw preallocated exceptions is the way to go

... and because noone has yet shown an explicit example:

     void myThrowingNogcFunc() @nogc {
         static const exc = new Exception("something went wrong");
         throw exc;
     }

As long as you don't need to pass a runtime argument to the 
constructor, there's no need for emplace acrobatics.


More information about the Digitalmars-d-learn mailing list