Real D

ShowMeTheWay ShowMeTheWay at gmail.com
Thu Apr 25 00:44:05 UTC 2024


On Tuesday, 23 April 2024 at 14:56:50 UTC, Marconi wrote:
>
> If D create some new way to make manual memory management 
> easily, in such a way that the lovers of GC would not be so 
> furious... the language could reach almost the perfection.
>

module nogc_test;

class Duck
{
     import core.stdc.stdio : printf;

     @nogc this(){ printf("quack! quack!\n"); }
     @nogc ~this(){ printf("I'm flyin away now......\n"); }
}

@nogc void test()
{
   scope auto d = new Duck(); // allocated on the stack
}

@nogc void main()
{
   test;
}



More information about the Digitalmars-d mailing list