throw Exception with custom message in nogc code

HubCool via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 5 05:52:47 PDT 2016


On Sunday, 5 June 2016 at 10:37:49 UTC, poliklosio wrote:
> On Sunday, 5 June 2016 at 06:25:28 UTC, HubCool wrote:
> Can you elaborate on how to dispose the exception?
> I'm partilularly interested in the code you would write in 
> place of the /*can dispose here too...*/ comment.

I don't know from where this idea came, I've never seen this, is 
it allowed ?

If so, dispose is not @nogc but since exceptions are quite simple 
classes they can be cleaned by hand without calling the ctor 
(since there's no ctor...). just Malloc.instance.dispose() would 
be enough. Even the size is not required (though it can also be 
retrieved with typeid().initializer.length.


More information about the Digitalmars-d-learn mailing list