The following code does what's expected
uint32_t a = 1, b = 2;
std::cout << static_cast<int64_t>(a) - b << '\n';
Prints -1
.
But if I change int64_t
to int
everything breaks:
std::cout << static_cast<int>(a) - b << '\n';
Prints 4294967295
.
Does anybody know what's the trick?