trick to make throwing method @nogc

Eugene Wissner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 25 12:54:38 PST 2017


On Saturday, 25 February 2017 at 20:49:51 UTC, Adam D. Ruppe 
wrote:
> On Saturday, 25 February 2017 at 20:40:26 UTC, Eugene Wissner 
> wrote:
>> it builds and doesn't throw if I compile with:
>> dmd -release
>> though it causes a segfault, what is probably a dmd bug.
>
> No, that's by design. assert(0) compiles to a segfault 
> instruction with -release.
>
>> A wrapper that unifies these 4 steps like enforce is pretty 
>> easy to implement.
>
> yeah easy to use exception in @nogc as long as the catch knows 
> to free it too.

But anyway segfault is not very descriptive :)


More information about the Digitalmars-d-learn mailing list