implicit or module-wide @nogc

Gokhhy gokhhy at gmail.com
Wed Jun 13 07:19:24 UTC 2018


On Wednesday, 13 June 2018 at 07:14:35 UTC, Gokhhy wrote:
> On Wednesday, 13 June 2018 at 07:11:56 UTC, Mike Franklin wrote:
>> On Wednesday, 13 June 2018 at 06:45:27 UTC, Gokhhy wrote:
>>> Is there a way to define an entire module as @nogc or 
>>> otherwise make it so I don't have to qualify every single 
>>> function as @nogc?
>>
>> You can put attributes at the top of a module followed by a 
>> ":" to have them apply to everything below them.
>>
>> module mymodule;
>>
>> @nogc:
>>
>> void nogcFunction1() { }
>>
>> void nogcFunction2() { }
>>
>> Mike
>
> Thanks, just what I was looking for.

Nevermind, it doesn't affect functions inside classes and structs.

I would be interested in what influenced the design decision to 
make opting out of garbage collection so difficult.


More information about the Digitalmars-d-learn mailing list