News for hackers. Stuff that matters.
Re:C++ 11 Approved by malkia on Saturday August 13, 2011 @02:02PM (#2881526)
But not putting one, using foreign code base might get you in trouble (resource leaking, not de-initializing certain piece of the parent, threads not closing, etc.).

This would've been prevented if destructors were always virtual.

My take is that if the compiler cannot make the decision, but it's left to you, in this case it's better to always have the virtual destructors ON.

The problem is more visual than analytical - you would have to dig through the whole hierarchy in several files to understand whether you need to put a virtual destructor or not. Compiler/Linker/some post-proc tool should be better at that job. It already has all that information.

Re:C++ 11 Approved by copper on Sunday August 14, 2011 @12:17AM (#2882792)
Hm, I'd rather pay the cost of having to add a virtual keyword in a few places (easily found using the equivalent of g++ -Wnon-virtual-dtor, and you do ship C++ code that is warning-free, right? :) rather than have to deal with up to eight bytes extra per instance in all my classes.
Re:C++ 11 Approved by malkia on Sunday August 14, 2011 @05:06AM (#2883196)
Thanks for the hint!

Actually I did not know about this option. I've just fixed such bug in one of our tools, written using wxWidgets for Windows. Have to check MSVC on this option.

At the same time a coworker was able to get the Xbox360 analyze thing and it worked finding suspicious stuff in the runtime code.

But we have only the professional version for PC :(

Re:C++ 11 Approved by DCoder on Sunday August 14, 2011 @06:07AM (#2883293)