destructor order
Albin Breen
abreen at ea.com
Wed Jan 26 04:55:22 PST 2011
Hi! I've been trying out D recently but I'm a little confused about the order in which destructors are called:
class A {
this() { writeln("ctor"); }
~this() { writeln("dtor"); }
static this() { writeln("static ctor"); }
static ~this() { writeln("static dtor"); }
}
void main() {
auto a = new A;
}
This will output:
static ctor
ctor
static dtor
dtor
I would have thought that the static destructor should be the last one (in case there are static dependencies). Have I missed something?
/Albin
More information about the Digitalmars-d
mailing list