Apache resigns from the Java Community Process executive committee
Apache resigns from the Java Community Process executive committee
Posted Dec 15, 2010 2:24 UTC (Wed) by HelloWorld (guest, #56129)In reply to: Apache resigns from the Java Community Process executive committee by paulj
Parent article: Apache resigns from the Java Community Process executive committee
shared_ptr has nothing to do with it, the same thing would happen if you'd delete the pointer by hand. The problem stems from the fact Bar's destructor isn't virtual.
I guess the reason for not making destructors virtual by default is that this would be inconsistent with the rest of the language, as other methods aren't virtual by default either. In the very early days of C++, member functions existed but virtual member functions were introduced only later. At that point, Bjarne chose not to make methods virtual by default, but you had to use the virtual keyword to make them. I probably would have done it the other way around, as the worst thing a virtual method call can do is make your program a little slower, while making a non-virtual method call can cause severe bugs.
So, whether this is a flaw in the language depends on whom you ask.
