HI Tanguy,

OK, since the changes are intrusive and widespread there certainly are
candidates for inclusion into 2.8.0, it's just too much of risk.

Changing the compile options should be less intrusive so I'd suggest
looking into adding this option to the VS compile options in
OpenSceneGraph/CMakeLists.txt.  One could make these extra build
options, optionally so that you can toggle them on/off from with
ccmake/CMakeSetup.

Robert.

On Wed, Feb 4, 2009 at 2:37 PM, Tanguy Fautre
<tang...@aristechnologies.com> wrote:
> Hi Robert,
>
> It's not a small set of changes. It's actually quite tedious (but not complex 
> to do). Unfortunately, we cannot be sure it avoids the invalid code 
> generation bug in all cases.
>
>
> Basically, changing the operator (in this case, it's operator -) from:
>
>
>    /** Binary vector subtract. */
>    inline const Vec3f operator - (const Vec3f& rhs) const
>    {
>        return Vec3f(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2]);
>    }
>
>    /** Unary vector subtract. */
>    inline Vec3f& operator -= (const Vec3f& rhs)
>    {
>        _v[0]-=rhs._v[0];
>        _v[1]-=rhs._v[1];
>        _v[2]-=rhs._v[2];
>        return *this;
>    }
>
>
> To:
>
>    inline Vec3f & operator -= (const Vec3f& rhs)
>    {
>        _v[0] -= rhs._v[0];
>        _v[1] -= rhs._v[1];
>        _v[2] -= rhs._v[2];
>        return *this;
>    }
>
>    inline friend Vec3f operator - (const Vec3f& lhs, const Vec3f& rhs)
>    {
>        return Vec3f(lhs) -= rhs;
>    }
>
>
> Seems to work around the problem with VS2005 and VS2008 without requiring 
> changes in the user code. Also, someone's pointed out the latter is more 
> correct in some cases (e.g. argument dependent lookup, see below).
>
> But changing all the operators of classes like Vec3f, Vec3d (and I suppose 
> others such as Matrix classes) would be quite tedious. I guess it really 
> depends on how many people are really by this problem.
>
> One a broader note, I've noticed Boost has a very nice library for dealing 
> with this (http://www.boost.org/doc/libs/1_37_0/libs/utility/operators.htm). 
> Too bad OSG probably cannot use it because of the dependencies it would 
> introduce. But it's still worth a read, as they explain several issues that 
> may not be obvious at first sight.
>
>
> Cheers,
>
> Tanguy
>
>
> -----Original Message-----
> From: osg-users-boun...@lists.openscenegraph.org 
> [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert 
> Osfield
> Sent: Wednesday 04 February 2009 12:40
> To: OpenSceneGraph Users
> Subject: Spam: Re: [osg-users] MSVC v9
>
> Hi Tanguy,
>
> On Wed, Feb 4, 2009 at 12:22 PM, Tanguy Fautre
> <tang...@aristechnologies.com> wrote:
>> Robert, do you thing the problem may be serious enough to possibly motivate
>> a code change for all operators of Vec3f and co as a workaround?
>
> We could change code, it would all depend on how intrusive the changes
> are, without code changes in front of me I can't make this judgement
> call.  Could you send me a modified Vec* files so I could do a review?
>
> The other approach is to change the compile flags of the OSG to avoid
> this bug.  This wouldn't help 3rd party apps though.
>
> Robert.
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to