DIP60: @nogc attribute

Timothee Cour via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 22:45:45 PDT 2014


I suggest adding a way to override a @nogc function for debugging purposes:

suppose we need to *temporarily* debug / instrument a function marked as
@nogc (myfun) by adding some piece of code that may allocate (quick and
dirty debugging). Unfortunately, in DIP60 we can't just temporarily remove
the @nogc attribute as myfun may be called by many other @nogc functions
and changing all those attributes would be too complex.

With the propose override, we can just recompile with a flag ; how to do
that is implementation detail but here's an option:

dmd -allow_gc_in_nogc fun.d

@nogc myfun(){

//temporary for debugging/instrumentation
@gc{
//code that can allocate
}

}



On Tue, Apr 15, 2014 at 10:01 AM, Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> http://wiki.dlang.org/DIP60
>
> Start on implementation:
>
> https://github.com/D-Programming-Language/dmd/pull/3455
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140415/e7cb424f/attachment.html>


More information about the Digitalmars-d mailing list