On Monday, 31 December 2012 at 00:30:58 UTC, Andrej Mitrovic wrote:

The basic rule is don't call or do anything which can allocate memory in a destructor. printf doesn't allocate, and if you don't do anything
that allocates you should be ok.

Does multi arg writeln even allocate? I don't underrstand why anyone would use ~ when writeln accepts variadic args...

//----
        ~this() {writeln(typeid(this).toString, "is dead");}
//----

Fixed! ... right?

If not, multy write?

//----
        ~this()
        {
            write(typeid(this).toString);
            write("is dead");
            writeln();
        }
//----

I'd think being forced to use the C fprint is overkill. I use writeln in my destructors all the time, and have never encountered this problem...

Reply via email to