Namespaces
Variants
Views
Actions

Talk:cpp/language/implicit cast

From cppreference.com

The part on integral promotion is not completely true. According to the Integral promotions section of the standard (4.5.1):

"A prvalue of an integer type other than bool, char16_t, char32_t, or wchar_t whose integer conversion rank (4.13) is less than the rank of int can be converted to a prvalue of type int if int can represent all the values of the source type; otherwise, the source prvalue can be converted to a prvalue of type unsigned int."

Means that an unsigned char will first be converted to an (signed) int (as it can contain all values of an unsigned char), not as mentioned on the page, only to unsigned short.

192.109.190.88 04:06, 27 September 2013 (PDT) Troels Frimor

Yes, that was an error, thank you for bringing it up. --Cubbi (talk) 06:31, 27 September 2013 (PDT)