Paul Martz wrote: > 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.
I see both sides here. My only input would be that some IDEs (VC++ among them, I believe) have better facilities for understanding and displaying constants defined as enums than as const variables. For example if I have an enum of FOO defined as 4, and I have a variable of the enumerated type containing 4, the debugger will display it to me as FOO (4) which is more meaningful than just (4). However, with bitmasks, you'll hardly ever have just a single bit set, so the IDE's enum interpretation ability kind of goes out the window. So, I'd lean towards whatever makes the cleanest reading and compiling code. It seems to me like this would be the static const unsigned int. No ugly casts when used, no ugly warnings when compiled. But if the same thing can already be achieved with the enum+signed technique, then I'm ok to leave well enough alone. > 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. :-) Ooooooh, we could start a whole new OSG list just for code style fights and then unearth the old extensionless headers arguments on the first day of each month just for fun! "In this corner, the defending champion, Decorator Pattern and on the opposite side of the ring, the visiting challenger, VISITOR!" > Thanks, -- Chris 'Xenon' Hanson, omo sanza lettere Xenon AlphaPixel.com PixelSense Landsat processing now available! http://www.alphapixel.com/demos/ "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org