On Wed, Jun 22, 2011 at 11:29 AM, Robert Osfield <[email protected]>wrote:
> Hi Ryan, > > NodeVisitor's subclasses are meant to only override the methods they > need to. It's what makes the convinient and powerful. > Yes, of course - for some time I was confused on how a visitor could be implemented _without_ triggering this warning. The documented problems which the warning "issue" relate to aren't > relevent to NodeVisitor usage. This compiler warning "issue" is in > practice just a distraction that will lead to more code bloat and > potential problems. FYI, different compilers have complained about > this "issue" on and off for the last decade but not once in the > history of the OSG has there been a bug due to this "issue". Adding a > using osg::NodeVisitor::apply to all subclasses just to quieten down a > silly warning is what I would call a good coding practice. > > Yes, when thinking through it, I couldn't think of an instance in which it would affect use, since Visitors are generally only handled by a base class reference, but the warning was the most frequent. I'm unsure I understand your thoughts on a resolution - are you saying we should add "using osg::NodeVisitor::apply;" or that we should ignore the warning? Thanks! Ryan > Robert. > > On Wed, Jun 22, 2011 at 5:17 PM, Ryan Pavlik <[email protected]> wrote: > > All, > > I've been working to get all the code I use to compile cleanly using > Clang, > > which is a faster, stricter, yet more helpful compiler than gcc. I > actually > > would like to get things to build cleanly with -Wall -Wextra in Clang > since > > those are often potential errors. I'll submit a full warnings log in a > > later email along with the build patches, but I wanted to mention one > issue > > separately. > > Apparently resolution of overloaded functions takes place on the name > only, > > rather than the full signature, which interacts with virtual functions. > In > > NodeVisitor, a number of virtual functions are declared with the same > name, > > apply, as required for the visitor pattern. It seems that according to > the > > standard, unexpected things may happen if not all overloads are > implemented > > in a subclass. The best discussions of this issue that I've found so far > are > > here: > > http://www.codeguru.com/forum/showthread.php?t=459396 > > https://groups.google.com/forum/#!topic/mozilla.dev.builds/60CACLzH_YM > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423 > > > https://www.securecoding.cert.org/confluence/display/cplusplus/OOP03-CPP.+Prefer+not+to+overload+virtual+functions > > - note that the ideal solution is only mentioned in the comments > > The apparent best solution is for all NodeVisitor subclasses to include a > > line equivalent to: > > using osg::NodeVisitor::apply; > > (replacing osg::NodeVisitor with a more specialized base class where not > > inheriting directly from NodeVisitor) > > That said, I haven't worked on this too long or done extensive testing, > but > > it is an issue I wanted to bring up. > > Ryan > > > > -- > > Ryan Pavlik > > HCI Graduate Student > > Virtual Reality Applications Center > > Iowa State University > > > > [email protected] > > http://academic.cleardefinition.com > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- Ryan Pavlik HCI Graduate Student Virtual Reality Applications Center Iowa State University [email protected] http://academic.cleardefinition.com
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

