Subject: Re: [ub] signed left shifts again
From: John Regehr (regehr_at_[hidden])
Date: 2013-11-13 17:26:08
> I have not seen the examples, but is it not the case that casting to unsigned
> before the shifts would have created defined behavior?
Yes, all of the undefined behaviors due to LHS of shifts would go away
with appropriate casts. I imagine that people just don't realize these
The bulk of the UBs were due to promotion of unsigned char to int. A
minority were due to variables that were declared as signed types in the
first place -- not a good idea, as you remarked earlier.
SG12 list run by email@example.com