[Development] Is overriding an existing virtual method 'BC' in Qt 4?
Marc Mutz
marc.mutz at kdab.com
Fri Sep 28 00:40:26 CEST 2012
On Thursday September 27 2012, Simon Hausmann wrote:
> On Thursday, September 27, 2012 09:08:52 AM João Abecasis wrote:
> > Thiago Macieira wrote:
> > > But note that there's one stricter requirement: the forwards
> > > compatibility that applies within a patch series. Adding this new
> > > virtual within the same
> > > patch series means a new, public symbol, which could get used in
> > > applications.
> >
> > I don't know how to fix this, but is there a hard technical reason why
> > the reimplementation of a virtual function needs to be *exported*?
>
> Sub-classes of the class that newly re-implements the virtual method will
> refer to the symbol of the newly re-implemented virtual method once they're
> recompiled against the new headers. If the symbol isn't exported it won't
> link
The compiler also devirtualises function calls if it can prove that the
dynamic type is the same as the static type, e.g. in constructors, or just
after a new-expression, or when the type has been created as an automatic
object.
If it does, the symbol needs to be available.
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
More information about the Development
mailing list