I don't think C ++ deviates from the way C handles signed / unsigned conversions:
Conversion rules are more complex when unsigned operands are involved. The problem is that comparisons between signed and unsigned values ββdepend on the machine, because they depend on the sizes of the various integer types. (K & R)
One important factor to consider is whether one of the types is a long integer or not, because this will affect whole promotions. For example, if a long int compared to unsigned int , and a long int can represent all the values ββof unsigned int , then unsigned int will be converted to long int . (Otherwise, both of them just convert to unsigned long int .)
In most cases, the compiler should convert signed integers to unsigned integers if it detects a mismatch.
source share