Skip to main content

All Questions

1 vote
2 answers
2k views

In C++, Why do bitwise operators convert 8 or 16 bit integers to 32 bit?

Is there a logical reason why the integer is upgraded to 32+ bits? I was trying to make an 8bit mask, and found myself a bit disappointed that the upgrade will corrupt my equations. sizeof( quint8(0)...
Anon's user avatar
  • 3,633
73 votes
2 answers
9k views

Why do bitwise operators have lower priority than comparisons?

Could someone explain the rationale, why in a bunch of most popular languages (see note below) comparison operators (==, !=, <, >, <=, >=) have higher priority than bitwise operators (&, |, ^...
SF.'s user avatar
  • 5,206