about destroy and delete.

Dsby via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 20 01:10:15 PDT 2016


I see https://dlang.org/deprecate.html#delete
The delete will be removeed,  when will be deprecate?

and i test destroy/GC.free and delte in struct, the value is 
difference;

struct Struct
{
     string value = "struct";
     ~this()
     {
         writeln(value);
     }
}

void main()
{

     auto s = new Struct();
     delete s;

     writeln("----------------");

}

will printf :
struct
----------------

But in
void main()
{

     auto s = new Struct();
     s.destroy;
     GC.free(s);

     writeln("----------------");

}

will printf :
----------------
struct

If I only GC.free(s); only printf: ----------------

so, I want to know why don't destroy direct printf ?


More information about the Digitalmars-d mailing list