Consider following code:
void foo(unsigned int x) { } int main() { foo(-5); return 0; }
Compiles with no problems. Errors like this c
Because the standard allows implicit conversion from signed to unsigned types.
signed
unsigned
Also (int)a + (unsigned)b results to unsigned - this is a c++ standard.
(int)a + (unsigned)b