Peter Hrenka wrote:
Has anybody had a look at Qt's QFlags? http://doc.trolltech.com/4.5/qflags.html

They provide a type-safe way of dealing with bit-mask-style enums.
The implementation is mostly a template class with overloaded
operators. Once you have the idea, it should be rather trivial
to reimplement this from scratch and tailor it OSG's requirements.

Wow, that's really interesting. I never imagined there were so many bitflag/mask patterns available.

But I imagine you guys already know how I feel about this. :-)

Personally, I already feel that using an enum to store bitflags is overkill. Defining an entire class to implement the bitflag/mask pattern along with set/get methods strikes me as the epitome of C++ abuse. I don't think I can back this, not even if measurements indicate no memory or performance bloat. It's an unnecessary layer of obfuscation.

Using bitwise logic ops and unsigned bits/masks makes it perfectly clear what is happening, even at the assembly level. It reduces the potential for error and makes the code more readable. It works great in this simple form. It's not broke, and does not need to be fixed with a new C++ class.

But I'm content to let Robert make the final call on this one. Clearly, we can't agree on a path forward ourselves. Further discussion is pointless; we should wait until he wraps up GL ES 2 and has time to respond to this issue.
   -Paul
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to