Re: [sigc] sigc::trackable::~trackable() is not virtual



On Thu, 2006-10-26 at 17:19 +0200, stephan beal wrote:

> It's not silly at all!!!! You're relying on UNDEFINED BEHAVIOUR when you 

just to be clear, what i said about "this is silly" was focusing on the
size of trackable and derivatives when runtime performance was so poor.

> subclass a type which doesn't have a virtual dtor.
> 
> Consider this: 
> 
> struct A : public sigc::trackable { ... };
> 
> sigc::trackable * foo = new A;
> delete foo;

see this note in trackable.h:

  /*virtual ~trackable() {} */  /* we would need a virtual dtor for
users
                                   who insist on using "trackable*" as
                                   pointer type for their own derived
objects */

and smile :)

--p





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]