This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question w.r.t. `'class Foo' has virtual functions but non-virtualdestructor` warning.


Joe Buck <Joe.Buck@synopsys.COM> writes:

| On Fri, Mar 04, 2005 at 08:06:27PM -0600, Chris Lattner wrote:
| > In my mind, the times you want to silence the warning (without defining 
| > the virtual dtor) are when you *know* that it will never be used that way, 
| > because it's part of the contract of the class.
| 
| In my view, if a class defines virtual functions, then this implies
| that the class is intended to be derived from, so a non-virtual

I agree that implies that it is class that is intended to be derived
from; but that does not imply it is a class intended to be used as
"delete argument". 

Here, we have lots of classes here of that type -- interface classes +
implementation classes with no resource management.  Adding a virtual   
destructor just to silent a misguided warning is close to "silly
compiler" in my book.

| destructor is asking for trouble and should be warned about, even
| if there is no "delete".

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]