@nogc and exceptions

via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 13 01:19:09 PDT 2014


On Friday, 12 September 2014 at 21:31:45 UTC, Johannes Pfau wrote:
> 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).

That's not what I mean, please see here:
http://forum.dlang.org/thread/ftakrucgtfcicfbkzwbs@forum.dlang.org#post-xmvzmufjywcsxviooivl:40forum.dlang.org


More information about the Digitalmars-d mailing list