Drawbacks of exceptions being globally allocated

Mathias LANG geod24 at gmail.com
Mon Aug 16 05:47:10 UTC 2021


On Monday, 16 August 2021 at 05:36:07 UTC, Tejas wrote:
>
> That is why I was using heapAllocate, because using `new` on 
> scope allocates exception on stack, and if you exit, then the 
> exception is basically freed before it even gets caught. It 
> fails even when you catch within the same function.
>
> But allocate on heap and giving ownership to a `scope` 
> qualified variable is no problem at all. No `signal 11` killing 
> my process ^_^

You are relying on an accept-invalid though. The compiler *should 
not* accept that code, but currently erroneously does so.


More information about the Digitalmars-d-learn mailing list