How to use destroy and free.

Mike Parker aldacron at gmail.com
Tue May 3 13:30:41 UTC 2022


On Tuesday, 3 May 2022 at 12:59:31 UTC, Alain De Vos wrote:
> Error: array literal in @nogc function test.myfun may cause a 
> GC allocation
>
> @nogc void myfun(){
> 	scope int[] i=[1,2,3];
> }//myfun
>
> May is a fuzzy word...

It means if the compiler is free to allocate on the stack if 
possible. In practice, though, you can usually assume there will 
be a GC allocation.


More information about the Digitalmars-d-learn mailing list