This is a request for comments on something I am considering doing in Practical.
The suggestion is this: bit operations (
>>) will not be allowed on signed types.
Rational: This eliminates a wide host of bugs, a bunch of undefined behaviors in C++, and generally makes the language clearer. As a C/C++ programmer, I know that I never was quite sure what will happen when I try that.
What if someone really wants to anyway?
I suggest the following alternatives:
- Convert to unsigned type via
reinterpret_cast, perform the operation, and convert back.
- Find a suitable alternative. E.g. : replace
Opinions, flames and general trolling welcome at this point (seriously, I’m that desperate).