Developers and getting them to improve their code.

Werner Trobin kde-optimize@mail.kde.org
Wed, 8 Jan 2003 21:40:07 +0100


On Wednesday 08 January 2003 21:28, Zack Rusin wrote:
> On Wednesday 08 January 2003 15:13, Benjamin Meyer wrote:
> > > I _guess_ the dtor was added to allow future extensibility. The
> > > Q_OBJECT looks necessary to me though, because without it it would
> > > be impossible to use signals/slots in a class derived from the uic
> > > generated one, or?
> >
> > Nope works fine.  For quite a bit of QTE code I manually removed the
> > deconstructors and the QOBJECT lines to reduce binary size and
> > increase speed.  All fo the classes were inherited and implimented in
> > a child.  A class only needs QOBJECT if it has a signal or slot from
> > what I understand.
>
> I'm still not sure what optimization are you trying to achieve by
> removing the dtor. Considering you inherit from QObject (thanks, Simon,
> I don't know, my brain froze and I neglected the fact that all those
> widgets inherit from QObject) the dtor will stay virtual. So what
> advantage does removal of the empty one have?

Removing the (empty) implementation of a virtual destructor might even 
decrease the performance! The compiler puts a generated version of the 
destructor in every translation unit where it needs it, so you might end up 
with a bigger binary size.

Ciao,
Werner