|
From: Thomas Maeder on 27 Jun 2008 15:42 "Angel Tsankov" <fn42551(a)fmi.uni-sofia.bg> writes: > Why not treat as erroneous a new expression that creates an instance > of a class which has a (direct or indirect) base class with a > non-virtual destructor and require implementations issue a > diagnostic message? Becasue the error is not in the new expression, but in the *possible* delete expression that attempts to delete the object through a pointer to base without virtual destructor. If anything, delete expressions applied on pointers to base classes without virtual destructor should be considered erroneous. > This would minimize the chances for resource leaks and for undefined > behaviour in C++ programs. Undefined behavior yes, but I can't imagine where your suggestion (or mine) would avoid a resource leak. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: problem with iterator declaration within template Next: Public member variables acceptable? |