Implicit conversion automatically changes a value to the type required by an initialization, assignment, function argument, or arithmetic operation. The value may fit harmlessly, lose information, become implementation-defined, or change meaning through signedness. section 5.4 section 18.1.2
A conversion can be harmless—or dangerous
double a = 1; converts exactly to 1.0, while signed short b = -1 preserves its value. In signed int c = 0x8000'0000, the unsigned value is too large for the destination and the result is implementation-defined. In unsigned short g = 0x8000'0000, information is lost and the resulting value is 0. section 5.4
C applies several related conversion mechanisms:
- Unary + and - use the type of their promoted operand; -1 is signed int, whereas -1U is unsigned int and has a large positive value. section 5.4
- Integer promotion widens narrow integer types such as bool, char, and short before supported arithmetic or function use. section 18.1.2
- Default argument conversion changes a float result to double when a variadic function such as printf receives it. section 18.1.2
- Default arithmetic conversion chooses a common type for binary operators; -1 + 1U converts -1 to unsigned int, producing UINT_MAX before addition. section 18.1.2
Figure 18.1 Upward conversion of some standard arithmetic types. Black arrows conserve values; red arrows (between narrow and wide types) may occur for integer promotion or default argument conversion; blue arrows (from signed to unsigned types) are reduction modulo \(2^{N}\); well-definition of gray arrows (with question marks) depends on the platform; green arrows (from integers to floating types) may lose precision.
Use the conversion diagram to compare value-preserving promotions, modulo reduction from signed to unsigned types, platform-dependent paths, and possible floating-point precision loss. section 18.1.2



