DIP60: @nogc attribute

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 13:41:41 PDT 2014


On Tue, 15 Apr 2014 15:47:58 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 4/15/2014 12:14 PM, Steven Schveighoffer wrote:
>> What specifically is prevented? GC.malloc, GC.free, clearly. What about
>> GC.getAttr? GC.query? These will not invoke collection cycles (the  
>> point of @nogc).
>
> All functions not marked as @nogc cannot be called from a @nogc  
> function. GC.malloc(), etc., are functions.
>
> It works very much analogously to nothrow.
>

right, but at the end of the day, nothrow doesn't allow throw statements.  
@nogc, so far, just doesn't allow you to call other functions that aren't  
marked @nogc. There is no primitive that is not allowed (I assume new  
isn't allowed, but you can access the GC other ways).

These requirements, or assumptions, need to be documented.

-Steve


More information about the Digitalmars-d mailing list