Hi Paul,

 

> -----Original Message-----
> 
> Jolley, Thomas P wrote:
> > Not sure I should jump into this but it's hard to stay out. 
> 
> Yeah, it's one of those issues. Hopefully Robert will chime 
> in soon. My guess is he'll probably elect to propagate the 
> osgUtil::Optimizer design pattern. It'd be fun to place bets. :-)

I think so to.

> 
> > Perhaps the second argument type in 
> osgUtil::Optimizer::optimize should be changed from unsigned 
> int to OptimizationOptions.  You can still use the enum and 
> avoid the confusion of whether it is signed or unsigned.
> 
> Have you actually used this in software that you've written? 
> How did you OR the bit values together?
> 
> Code of the following form will not compile:
>      osgUtil::Optimizer::OptimizationOptions flags( 0 );
>      flags |= osgUtil::Optimizer::SHARE_DUPLICATE_STATE;
>      flags |= osgUtil::Optimizer::MERGE_GEODES; And if the 
> 2nd param to optimize were OptimizationOptions, the following 
> code would not compile:
>      optimize( node,
>          osgUtil::Optimizer::SHARE_DUPLICATE_STATE |
>          osgUtil::Optimizer::MERGE_GEODES );
> 
> "|" and "|=" are not defined for enum types. So I'm a little 
> confused by this suggestion.

I should have looked closer to the enumerations in this example and how they 
would be used.  For some unexplained reason I wasn't thinking of doing a 
bitwise OR.  In cases where I need to bitwise OR enumerations I've assigned the 
result to an int.  I suppose you could do some of the above with some ugly 
casting.

> 
> > An unsigned int will work just as well as a signed int for 
> bitmask.  All the bitwise logical operations work the same.  
> Testing for == 0 and != 0 work the same.  Shift left works 
> the same.  The only things that don't work the same are shift 
> right and some arithmetic operations you wouldn't want to do anyway.
> 
> I hear you, but this is not a reason to make them signed 
> rather than unsigned. It is just a statement that they are 
> equivalent in this respect.

So, if they are equivalent in this respect then why prefer "unsigned int" over 
"int"?  "int" is easier to type.  Fewer compiler warnings (although I haven't 
seen any on my compilers).
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to