Whenever I run the code :
signed short ssh{-3};
unsigned short ussh{1};
std::cout << ussh + ssh << '\n'; // should be (65535-2+1) = 65534
I get the output as -2 instead of 65534
while the same wrap-around functionality works well with the unsigned long and unsigned int.
Is unsigned short prohibited to perform wrap around or it is just promoted into int??
The rules for integer promotion are very clear for C++. Both values are going to be promoted to a type that has a range that can accept the values without change, which in your case is
int.Nothing is wrapping.