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

Reply via email to