[osg-submissions] Fix "hidden virtual" warnings introduced since 2.2.0
Andrew Bettison
andrewb at acres.com.au
Mon May 26 03:01:04 PDT 2008
Robert is right, the "hidden virtual" warnings I want to eliminate
indicate neither a bug in the compiler nor in OSG, because in this
particular case, either (a) the methods in question are never invoked
via a pointer to the subclass, only via a pointer to the base class (eg,
osg::NodeVisitor), in which case they are not hidden and the
polymorphism works exactly as intended, or (b) the C++ argument
overloading semantics result in the correct (intended) method of the
subclass being called (eg, in the case of osg:NodeVisitor, the
inheritance graph of osg::Node and its subclasses exactly matches all
the defined osg::NodeVisitor::apply() base methods).
In any case, warnings from OSG headers are still a problem for me, and
probably will be for others in future, too, since warnings-as-errors is
a common practice, and it's inadvisable to suppress this particular
warning, since in the general case, an unintentionally hidden virtual
method can indeed be a bug and a hard to spot one at that.
So I am re-submitting my patch, this time replacing all the extra
methods with "using" declarations (as Tim Moore suggested), one per
subclass wherever an overloaded virtual is overridden. This does not
introduce any new code that could make OSG more fragile, since the
additions are not "code" per se (they are declarations). I hope that
this patch will pass muster where my original failed. My only concern
is that "using" declarations might not be supported by all C++ compilers
currently in use by OSG users. However, the "using" declaration has
been part of the OSI C++ standard since 1996.
-- Andrew Bettison
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CollectOccludersVisitor
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080526/d12f5152/attachment-0006.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: GraphicsThread
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080526/d12f5152/attachment-0007.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: DatabasePager
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080526/d12f5152/attachment-0008.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SharedStateManager
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080526/d12f5152/attachment-0009.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Text
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080526/d12f5152/attachment-0010.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CullVisitor
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080526/d12f5152/attachment-0011.txt>
More information about the osg-submissions
mailing list