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

2005-03-06 Thread Gabriel Dos Reis
David Carlton <[EMAIL PROTECTED]> writes: | On Fri, 04 Mar 2005 19:15:41 -0600 (CST), Chris Lattner <[EMAIL PROTECTED]> said: | | > It's not a matter of warning vs not warning: it's a matter of | > emitting bogus warnings *sometimes* when you can emit the proper | > warning *all of the time*. |

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

2005-03-06 Thread Gabriel Dos Reis
Joe Buck <[EMAIL PROTECTED]> 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 o

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

2005-03-06 Thread Gabriel Dos Reis
Mark Mitchell <[EMAIL PROTECTED]> writes: [...] | > It seems that the warning could be improved to be emitted when the | > *delete* is seen of a class without a virtual dtor (but that does | > have virtual methods). If you never actually do the questionable | > behavior, you'd never get the warn

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

2005-03-06 Thread Gabriel Dos Reis
Chris Lattner <[EMAIL PROTECTED]> writes: | Karel Gardas wrote: | > Yes, that's undefined, but I just define this class to be able to do: | > Foo* f = dynamic_cast(x); | > l = f->iiop_version(); | > there is nothing like delete involved. Anyway, I agree with you that | > emit warning about this is

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

2005-03-04 Thread Joe Buck
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 v

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

2005-03-04 Thread David Carlton
On Fri, 04 Mar 2005 19:15:41 -0600 (CST), Chris Lattner <[EMAIL PROTECTED]> said: > It's not a matter of warning vs not warning: it's a matter of > emitting bogus warnings *sometimes* when you can emit the proper > warning *all of the time*. I don't think you can emit the proper warning all of t

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

2005-03-04 Thread Chris Lattner
On Fri, 4 Mar 2005, Mark Mitchell wrote: Chris Lattner wrote: I'm not sure I understand your point here. The library developer writes a class, and does not *want* it to be destroyed through the base class. As a library designer, I can intentionally make the dtor protected, making it pretty cle

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

2005-03-04 Thread Mark Mitchell
Chris Lattner wrote: I'm not sure I understand your point here. The library developer writes a class, and does not *want* it to be destroyed through the base class. As a library designer, I can intentionally make the dtor protected, making it pretty clear that delete should not be called on th

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

2005-03-04 Thread Chris Lattner
On Fri, 4 Mar 2005, Mark Mitchell wrote: Chris Lattner wrote: Age-old debate: better to warn early about possibly broken interfaces, or late about definitely broken usage? I think that warning early, together with what DJ is calling fine-grained warning control is the best solution. I don't agre

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

2005-03-04 Thread Mark Mitchell
Chris Lattner wrote: Age-old debate: better to warn early about possibly broken interfaces, or late about definitely broken usage? I think that warning early, together with what DJ is calling fine-grained warning control is the best solution. I don't agree at all on this. It's not a matter of

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

2005-03-04 Thread Chris Lattner
On Fri, 4 Mar 2005, Mark Mitchell wrote: I've run into this warning with C++ code as well, and it is quite annoying. There are lots of possible reasons to want to do this sort of thing, and adding a virtual dtor increases the size of the vtable for the class. Yeah, there goes one whole pointer pe

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

2005-03-04 Thread Mark Mitchell
Chris Lattner wrote: I've run into this warning with C++ code as well, and it is quite annoying. There are lots of possible reasons to want to do this sort of thing, and adding a virtual dtor increases the size of the vtable for the class. Yeah, there goes one whole pointer per class in your pr

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

2005-03-04 Thread Chris Lattner
Karel Gardas wrote: Yes, that's undefined, but I just define this class to be able to do: Foo* f = dynamic_cast(x); l = f->iiop_version(); there is nothing like delete involved. Anyway, I agree with you that emit warning about this is probably the right thing to do and so I will fix my code. I've