Evil and overloard don't play well in the same email, it really
doesn't strengthen you points, and we are talking about a tiny inline
function here, not dictators.
Also please learn about C++ and optimization, an temporary allocated
on a return in an inline function is the best possible combination for
compiler to be able to optimize away.
On 5/18/07, Antoine Rennuit <[EMAIL PROTECTED]> wrote:
Hi all,
I'm a bit surprised osg overloads operators that return a class, as in
Vec3d::operator-(<another Vec3d>) :
inline const Vec3d operator - (const Vec3d& rhs) const
{
return Vec3d(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2]);
}
I see a call to a Vec3d constructor in this piece of code, on the return
line, which also means a memory allocation. I thought memory allocation at
run-time was evil. Is that some kind of trade off between efficiency and
ease of use (to be able to call the operator- instead of a
Vec3d:difference(Vec3d, Vec3d) which would not be as smart)?
Regards,
Antoine.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/