Integer promotion unsigned in c++
int main() { unsigned i = 5; int j = -10; double d = i + j; long l = i + j; int k = i + j; std::cout << d << "\n"; //4.29497e+09 std::cout << l << "\n"; //4294967291 std::cout << k << "\n"; //-5 std::cout << i + j << "\n"; //4294967291 } I believe signed int is promoted to unsigned before doing the arithmetic operators. While -10 is converted to unsigned unsigned integer underflow ( is this the correct term?? ) will occur and after addition it prints 4294967291 . Why this is not happening in the case of int k which print -5 ? The process of doing the arithmetic operator involves a conversion