[ODE] Four little things

Matthew D. Hancher mdh at email.arc.nasa.gov
Wed Apr 14 21:48:07 MST 2004


Matthew D. Hancher wrote:
> why not have that function return a dJoint that is obtained by
> sneakily casting the result of dBodyGetJoint()

Or better yet (having eaten dinner) you could make the "casting"
non-sneaky by having a private constructor dJoint::dJoint(dJointID).

But the now-obvious problem is of course that you call dJointDestroy()
from the destructor, so you would wind up calling it twice.

So here's a question: is it better to have functions like dBodyGetJoint
behave strangely, or is it perhaps better to move ODE-internal
resource deallocation out of the destructor and into a destroy() member
function which the user could ensure gets called only once?   Either
sacrifice strikes me as a substantial blow to the C++ API; perhaps
there is another good alternative that I haven't yet thought of?

mdh

Matt Hancher
NASA Ames Research Center
Official: mdh at email.arc.nasa.gov
Personal: mdh at media.mit.edu


More information about the ODE mailing list