I can has @nogc and throw Exceptions?

Adam Sansier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 13 09:13:21 PDT 2016


On Wednesday, 13 July 2016 at 11:39:11 UTC, Lodovico Giaretta 
wrote:
> On Wednesday, 13 July 2016 at 00:57:38 UTC, Adam Sansier wrote:
>> [...]
>
> You shall use a static per-thread Region allocator[1] backed by 
> Mallocator[2].
> Then you just make[3] exceptions inside it and throw them.
> So you can allocate and chain exceptions until you end the 
> memory established on creation.
> Whenever you don't need the exception chain anymore (i.e.: you 
> catched them and program is back in "normal" mode, you just 
> reset the region allocator, so you have all of your memory 
> again, for the next exception chain).
>
> [1] 
> https://dlang.org/phobos/std_experimental_allocator_building_blocks_region.html
> [2] 
> https://dlang.org/phobos/std_experimental_allocator_mallocator.html
> [3] https://dlang.org/phobos/std_experimental_allocator.html

Am I going to have to do all this myself or is it already done 
for me somewhere?


More information about the Digitalmars-d-learn mailing list