On Thursday 26 October 2006 15:41, Paul Davis wrote:
> > But yes, this would be useful to me sometimes too. I believe the
> > choice was made once for performance.
>
> now this is silly. do you realize that every time you do this:
>
> someSignal.connect (mem_fun (someObject, &SomeObject::method))
>
> that the temporary slot (the one passed to the connect() method)
> creates its own trackable, adds a destroy notification callback to
...
> concern seem misplaced to me. avoiding the temporary slot
> from doing all this stuff would be much more productive in
> terms of cycles not wasted.
It's not silly at all!!!! You're relying on UNDEFINED BEHAVIOUR when you
subclass a type which doesn't have a virtual dtor.
Consider this:
struct A : public sigc::trackable { ... };
sigc::trackable * foo = new A;
delete foo;
You've now officially got UNDEFINED BEHAVIOUR, according to the C++
standard. It is illegal to delete a pointer to a derived type through a
parent-type pointer if the parent type's dtor is not virtual.
Virtual inhertiance has nothing to do with the dtor, AFAIK, but with the
way that the inheritance itself is declared:
struct A: public virtual B { ... };
For lots of info:
http://www.parashift.com/c++-faq-lite/multiple-inheritance.html
http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7
--
----- stephan s11n net http://s11n.net
"...pleasure is a grace and is not obedient to the commands
of the will." -- Alan W. Watts
Attachment:
pgpS1vHiSDsiU.pgp
Description: PGP signature