[Issue 2834] Struct Destructors are not called by the GC, but called on explicit delete.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 11 17:25:02 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=2834



--- Comment #7 from bearophile_hugs at eml.cc 2010-07-11 17:24:58 PDT ---
One case where struct destructors are not called, in this situation it seems
simpler for the GC to know what destructors to call:


import core.memory: GC;
import core.stdc.stdio: printf;
struct Foo {
    int x;
    this(int xx) { this.x = xx; }
    ~this() { printf("Foo dtor x: %d\n", x); }
}
void main() {
    Foo[] a;
    a.length = 2;
    a[0].x = 1;
    a[1].x = 2;
    // delete a;
}


(I am not sure, but a type information can be useful in arrays, maybe to fix
bug 2095 too.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list