@nogc and exceptions
Johannes Pfau via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 12 14:31:44 PDT 2014
Am Fri, 12 Sep 2014 12:59:22 +0000
schrieb "Marc Schütz" <schuetzm at gmx.net>:
> On Friday, 12 September 2014 at 03:37:10 UTC, Jakob Ovrum wrote:
> > 1b) Exceptions constructed at compile-time which are then
> > later referenced at runtime (as in the above snippet) must be
> > immutable (the compiler enforces this), as this feature only
> > supports allocation in global memory, not in TLS. This brings
> > us to an unsolved bug in the exception mechanism - the ability
> > to get a mutable reference to an immutable exception without
> > using a cast:
>
> Related: Last time I checked the runtime caches unwinding or
> stack trace information in the exception. It does this even for
> immutable exceptions...
Yes, in order to avoid allocating a stack trace helper you need to cast
the exception from its .init property, IIRC. There's some code in
druntime which does that (the out-of-memory error handling code).
More information about the Digitalmars-d
mailing list