2 ms·
This is all good and nice. But in my opinion it violates principle of least surprise: when I encounter any enum, am I able to OR two values? These do not seem
by omgtehlion 8y ago
This is all good and nice.
But in my opinion it violates principle of least surprise: when I encounter any enum, am I able to OR two values? These do not seem like flags, is this correct usage?
When a function expects bitmask<T>, I should know that T is just flag positions. But when I do not have some API point, only enum, how am I supposed to know that?
Plus, in case of interop with other languages, even with C, I will have Button::B == 2 in CPP, and BUTTON_B == 4 in C (or Button.B == 4 in Java). This of course adds to confusion...