I think we disagree on what, exactly, we disagree on. :-)

Unless I'm mistaken. we all agree that bit values should have the same data type as the bitmask variables meant to contain them.

Wojciech Lewandowski wrote:
> However, I will keep my opinion that when one decides to use enums for
> bit combinations,

This is where we begin to disagree, because, given the information that enums are always ints, then it's a mistake to use them as bit values. (I admit I'm guilty of propagating this mistake by following the design pattern precedent in osgUtil::Optimizer, without thinking about it too much.)

Rather than change bitmask variables to int to "match" the enum type (and I use the term "match" loosely here, because, IMO, an enum and an int are still conceptually different types), a better solution would be to Leave the bitmask variable as unsigned int, and change the enums to static const unsigned int.

I can't imagine a case where I would ever want to treat a bit or a bitmask as a signed value. I can imagine testing (mask != 0), but I can never imagine needing to test for (mask < 0) or (mask > 0). Knowing whether a bit or mask is negative or positive conveys no useful information.

Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466




_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to