gcc -Woverloaded-virtual

David Faure faure at kde.org
Mon Nov 26 18:19:15 GMT 2007


On Monday 26 November 2007, Aurélien Gâteau wrote:
> David Faure wrote:
> >> As for removeSubjob(), I found two calls to removeSubjob(job, true).
> >> Those are in copyjob.cpp. In the case of removeSubjob(), the default
> >> behavior is to not merge metadata, so it we can either:
> >> - add a removeSubjobAndMergeMetadata() method
> >> - add a separate mergeMetadata() method
> > Separate call sounds good. Doesn't really need a new method though,
> > there's already a mergeMetadata but that's for outgoing metadata
> > (job->slave) while here it's about the resulting metadata (incoming, i.e.
> > slave->job).
> > 
> > I would just do d->m_incomingMetaData += job->metaData() before
> > the removeSubjob(job) call.
> 
> Yes, it's probably simpler.
> 
> > And then the dynamic cast in removeSubjob can be removed altogether
> > (well, so the whole method is just a base class call, but maybe better
> > keep it in case we need it later?)
> 
> Adding a new virtual method to a class is not binary compatible, but
> reimplementing an existing virtual method is binary compatible, or am I
> wrong? In this case we don't need to keep the method.

It's BC but old programs that haven't been recompiled will not call the reimplementation
if we re-add it later.
So I would rather leave it, for symmetry with addSubjob being reimplemented.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list