Hi Paul, On 5/02/13 8:40, Paul Martz wrote: > I wanted to start a discussion on the CMake variable > OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION. Does anyone else besides me > change this > variable from its default ON state to OFF? If not, should we just remove it? > > The reason I ask is that it seems like every time I do an update from trunk, > the latest > source contains some changes that assume this variable is always on, and the > code fails to > compile if the variable is off. Here's an example: > osg::ref_ptr< osg::Group > source; > osg::Group* dest; > dest = source; // Compile error, should be "dest = source.get()" > > I got in the habit of always disabling implicit ref_ptr output conversion > because someone > once tried to use my osgWorks project with an OSG that had been built with > the CMake > variable turned off. The only way for me to make sure my project builds is to > do all my > testing with the CMake variable turned off. Code written with the variable in > an OFF state > will build whether the variable is ON or OFF, but code written with the > variable in its > default ON state stands a good chance of failing to compile when the variable > is flipped OFF.
I have never changed the CMake variable (having only vaguely been aware of it), but have always used 'source.get()' in my own code. Following the mantra 'explicit is better than implicit' I would like to advocate to remove the 'feature' (basically setting it to OFF) AND to remove the CMake variable. This follows std::shared_ptr and std::unique_ptr. Yes, this will break some code but maybe for the better? Cheers, /ulrich PS: On a related note: how do you folks feel about slowly starting to adopt C++11 features? I feel like a kid in a candy store with all the new stuff that has come along! :-D _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

