Objects of unsigned integral types can be converted to corresponding signed types. However, such a conversion can cause misinterpretation of data if the value of theunsigned object is outside the range representable by the signed type, as demonstrated in the following example:
#include <iostream.h>
void main()
{
short i;
unsigned short u = 65533;
cout << (i = u) << “\n”;
}
The following output results:
-3
In the preceding example, u is an unsigned short integral object that must be converted to a signed quantity to evaluate the expression (i = u). Because its value cannot be properly represented in a signed short, the data is misinterpreted as shown.