What is going on with bitwise operators and integer promotion?
I have a simple program. Notice that I use an unsigned fixed-width integer 1 byte in size. #include <cstdint> #include <iostream> #include <limits> int main() { uint8_t x = 12; std::cout << (x << 1) << '\n'; std::cout << ~x; std::cin.clear(); std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); std::cin.get(); return 0; } My output is the following. 24 -13 I tested larger numbers and operator << always gives me positive numbers, while operator ~ always gives me negative numbers. I then used sizeof() and found... When I use the left shift bitwise operator( << ), I receive an