More radical ideas about gc and reference counting

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 18:30:16 PDT 2014


On 4/30/2014 4:17 PM, H. S. Teoh via Digitalmars-d wrote:
> If we're going
> to have dtors at all, let's do it *right*. Guarantee they always work,
> and reject all usages that break this guarantee (like putting a struct
> with dtor inside a class,

Seems to work when I try it:

bar.d:
-------------------------
   import core.stdc.stdio;

   struct S { ~this() { printf("S.~this()\n"); } }

   class C { S s; }

   void main()
   {
     C c = new C();
     c = null;
   }
-------------------------
C:\cbx\mars>bar
S.~this()


More information about the Digitalmars-d mailing list