@gc attribute for bypassign @nogc

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 24 16:14:37 PDT 2016


On Sunday, 24 July 2016 at 22:21:51 UTC, ketmar wrote:
> On Sunday, 24 July 2016 at 22:13:02 UTC, bitwise wrote:
>> There is the following, which is clever. But if it came down 
>> to having to do this to bypass @nogc, I simply wouldn't use 
>> @nogc.
>
> that's what i ended up with: not using @nogc. it is pure 
> parketing thing. for real world using it adds more troubles 
> than it ever solved (and did it solve at least something?!).
>
> i'd say: "don't bother with @nogc, it is mostly useless."

I don't understand what you mean, saying it's useless.

I intend to do this:

class Script {
     @nogc void update(){}
}

class CustomScript : Script {
     override void update(){}
}

If I did this, it would act as a safety net, and prevent a lot of 
accidental allocations. Keep in mind, "update" is meant to run 
30-60 times per second, so allocations would add up extremely 
fast.

     Bit



More information about the Digitalmars-d mailing list