Request for comments: bit operations and signed types

This is a request for comments on something I am considering doing in Practical.

The suggestion is this: bit operations (|, &, ^, ~, << and >>) 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:

  1. Convert to unsigned type via reinterpret_cast, perform the operation, and convert back.
  2. Find a suitable alternative. E.g. : replace signed>>a with signed/(1<<a).

Opinions, flames and general trolling welcome at this point (seriously, I’m that desperate).

Shachar