Auto objects and scope

genie sgenie at maxnet.co.nz
Thu Nov 16 17:27:39 PST 2006


Forgive my ignorance, guys, but there is something in GC for D I
can't spin my head about - look at this bit of code:

Test tst=new Test;

...
if(b)
{
   auto Test t1=new Test;
   ...
   tst=t1;
}
...
tst.func();

auto modifier forces the object to be deleted even though it was
assigned to something else before leaving the scope - is this
behaviour correct?

Gene



More information about the Digitalmars-d mailing list