cmlibs / zinc

Source code repository for OpenCMISS-Zinc
Mozilla Public License 2.0
15 stars 18 forks source link

Make ModifierFlags and the like an `unsigned int` rather than an `int` #140

Open agarny opened 5 years ago

agarny commented 5 years ago

Bitwise operations can be done on ModifierFlags, which means that ModifierFlags should be an unsigned int rather than an int, as reported by the hicpp-signed-bitwise check using Clang-Tidy.

sgenie68 commented 5 years ago

As a rule of thumb this is correct - if a variable is only used for bitwise operations it is safer to keep it unsigned. As a matter of fact, I would go even further and use specific length-preset types, like u_int32 to ensure same length regardless of the platform/compiler/model used.