[osg-users] Change to Optimizer OptimizationOptions
Peter Hrenka
p.hrenka at science-computing.de
Tue Nov 3 01:17:00 PST 2009
Hi,
Paul Martz schrieb:
> Hi Robert -- The code submission by Wojciech and I for MSFBO has opened
> a small can of worms on declaring bits and bitmasks. I hope you can
> weigh in and put an end to the debate.
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.
Cheers,
Peter
> Originally, my submission followed the Optimizer's OptimizationOptions
> pattern of declaring bit values in an enum, but declaring the bitmask
> variable as an unsigned int.
>
> In Wojciech's modified submission, he changed the bitmask variable to a
> signed int, with the reasoning that enum values are also signed ints,
> and this eliminates the need for a typecast to get rid of compiler
> warnings.
>
> This caused me to weigh in with the workaround of declaring the bit
> values as static const unsigned int, and keeping the bitmask unsigned.
> But this goes against the OSG precedent set with the Optimizer.
>
> The ensuing discussion has covered the merits, or lack thereof
> (depending on the poster) of declaring bitmasks as signed or unsigned.
>
> What this really boils down to is: If we decide that the MSFBO
> bit/bitmask declarations should be different from the Optimizer pattern
> for bits and bitmasks, then we should change the Optimizer to follow the
> new standard, and also do the same for any other classes that followed
> the Optimizer's current pattern.
>
> If you could post with "do it this way" or "do it that way", I (for one)
> could get back to work and stop prodding everyone with my code style
> opinions. :-)
> Thanks,
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier,
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196
More information about the osg-users
mailing list