@nogc for structs, blocks or modules?

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 16 01:51:26 PST 2016


On Tuesday, 16 February 2016 at 03:13:48 UTC, maik klein wrote:
> On Tuesday, 16 February 2016 at 02:47:38 UTC, WebFreak001 wrote:
>> On Tuesday, 16 February 2016 at 02:42:06 UTC, maik klein wrote:
>>> I just seems very annoying to add @nogc to every function.
>>
>> you can mark everything as nogc with
>>
>> // gc functions here
>>
>> @nogc:
>>
>> // nogc functions here
>> void foo() {}
>
> Thanks, this should probably added to 
> https://dlang.org/spec/attribute.html#nogc
>
> I just realized that I can't even use @nogc because pretty much 
> nothing in phobos uses @nogc

You probably can, remember that templates have their attributes 
inferred.


More information about the Digitalmars-d mailing list