On Fri, 23 May 2008 12:54:27 +0100 "Robert Osfield" <[EMAIL PROTECTED]> wrote:
> Hi Andrew, > > This particular warning is broken in the context of the visitor > pattern. The warning doesn't highlight a bug, but fixing this bogus > warning can introduce bugs because of the unnecessary dummy code that > has to be introduced. I deem this *extremely* bad practice so will > not merge these "fixes" into the code base as it'll lower overall > maintainability and is far more likely to introduce bugs than the > original code. > > Might I recommend that this warning is switched off completely if you > can. > > Robert. I understand that this "bug" doesn't affect the operation of NodeVisitor, but isn't it sufficient to say "using NodeVisitor::apply;" in the definition of the derived classes in order to make the warning go away? Tim > > On Fri, May 23, 2008 at 11:51 AM, Andrew Bettison > <[EMAIL PROTECTED]> wrote: > > I am working on a project which uses OpenSceneGraph and is compiled > > using GCC with all warnings enabled and treated as errors. This is > > mandated by the client and in the contract, plus it's good practice > > in general. > > > > Until recently I was building against the wonderful OSG 2.2.0 > > library (which is current on Debian testing), but I have just > > downloaded, built from source, and installed OSG 2.4.0, which I > > hope will be even more wonderful. However, it produces many > > warnings of the following kind, which did not appear in 2.2.0, and > > which make it impossible for my project to build successfully: > > > > /usr/include/osg/NodeVisitor:233: warning: 'virtual void > > osg::NodeVisitor::apply(osg::Geode&)' was hidden > > /usr/include/osg/CollectOccludersVisitor:49: warning: by > > 'osg::CollectOccludersVisitor::apply' > > > > This is the "hidden virtual" problem, described in this C++ FAQ > > LITE item. It is a real drag, because it makes the visitor pattern > > cumbersome to implement, since you have to define visit (or in this > > case, apply) methods for every single overloaded argument, in every > > single subclass. Then, if you want to handle a new type in your > > Visitor superclass, you have to add the new method to every single > > subclass. As far as I know, there's no way around this in C++. > > > > So I attach some patched header files that eliminate the warnings by > > defining all the hidden methods. I haven't done a thorough search > > through OSG 2.4.0 to find all instances of this kind of error; I > > have only fixed the warnings that I have encountered so far in my > > project. If I find more, I will submit more patches. > > > > Regards, > > Andrew > > > > _______________________________________________ > > osg-submissions mailing list > > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
