On 17/11/2015 17:54, Laszlo Ersek wrote:
> I'm not worried. I hate it for the mental load it represents.
> 
> For me, the fact that the negative sign is encoded (with *any* kind of
> representation) within the bit pattern subject to shifting, makes the
> negative sign *inherently* incompatible with shifting.
> 
> In real life, *you don't shift a sign*. It just makes no sense. The sign
> is not a digit. You can append or cut off zeroes from the right, but the
> sign is not subject to that. The sign doesn't care.

I agree.  That's why I said elsewhere that it's *okay* for me if e.g.
0xC0000000u << 2 is undefined behavior.  In fact, it's mostly okay for
me if shift _into_ the sign bit were undefined behavior.

Basically, I avoid the "mental load" with a rule that left shift is just
multiplication by 2^N.

Paolo

Reply via email to