DIP60: @nogc attribute
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 25 05:59:55 PDT 2014
On Fri, 25 Apr 2014 08:21:38 -0400, David Nadlinger <code at klickverbot.at>
wrote:
> On Friday, 25 April 2014 at 12:07:00 UTC, Steven Schveighoffer wrote:
>> One interesting thing about this is that the compiler implementation
>> may make some @nogc code valid on some compilers, and invalid on
>> others, even though the resulting execution is the same.
>
> I don't think this is a desirable behavior. @nogc should be decided in
> the frontend, before closure allocation optimizations take place.
I don't know that it's desirable to have @nogc reject code even though an
allocation does not occur. I agree the situation is not ideal, but @nogc
is a practical optimization.
I can think of other cases where the GC may be optimized out. To reject
such code in @nogc would make it much less attractive.
-Steve
More information about the Digitalmars-d
mailing list