DIP60: @nogc attribute

via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 25 05:46:51 PDT 2014


On Friday, 25 April 2014 at 12:21:40 UTC, David Nadlinger 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.

Yes, but the language specification should guarantee that no heap 
allocation takes place at least for some simple cases. `scope` 
comes to mind... This can apply to other normally allocating 
operations, too, like `new` and array concatenation/appending.


More information about the Digitalmars-d mailing list