@nogc and exceptions
Jakob Ovrum via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 12 18:58:32 PDT 2014
On Friday, 12 September 2014 at 12:47:46 UTC, Vladimir Panteleev
wrote:
> On Friday, 12 September 2014 at 03:37:10 UTC, Jakob Ovrum wrote:
>> I can think of a couple of ways to go:
>
>> 1) The most widely discussed path is to allocate exception
>> instances statically, either in global memory or TLS.
>> Currently, this has a few serious problems:
>
> Another problem with this is that you'll need to change every
> instance of "new FooException" to something else.
I don't think this is a big problem, `@nogc` will tell you where
the allocations are, and it's fairly easy to just grep and
replace. It's also worth noting that code using enforce et al.
could be updated automatically.
Further, you only need to do this if you want your library code
to be `@nogc`. Existing code using the GC-heap will keep working
(except for the `scope` thing I proposed...).
More information about the Digitalmars-d
mailing list