Consider assignments such as `double a = 1;` and `signed int c = 0x80000000;`. C silently converts the right-hand value to the declared type, but the result is safe only when the value fits. A conversion can instead lose information, become implementation-defined, or expose a signedness hazard. section 5.4
double a = 1; // Harmless; value fits type
signed short b = -1; // Harmless; value fits type
signed int c = 0x80000000; // Dangerous; value too big for type
signed int d = -0x80000000; // Dangerous; value too big for type
signed int e = -2147483648; // Harmless; value fits type
unsigned short g = 0x80000000; // Loses information; has value 0
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":6}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":12}],[{\"line\":5,\"ch\":2},{\"line\":5,\"ch\":14}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":10}],[{\"line\":3,\"ch\":0},{\"line\":3,\"ch\":10}],[{\"line\":4,\"ch\":0},{\"line\":4,\"ch\":10}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":10}],[{\"line\":3,\"ch\":0},{\"line\":3,\"ch\":10}],[{\"line\":4,\"ch\":0},{\"line\":4,\"ch\":10}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":10}],[{\"line\":3,\"ch\":0},{\"line\":3,\"ch\":10}],[{\"line\":4,\"ch\":0},{\"line\":4,\"ch\":10}],[{\"line\":5,\"ch\":0},{\"line\":5,\"ch\":14}]]"}
!@%STYLE%@!
Compare harmless, dangerous, and information-losing conversions side by side. section 5.4
Read each conversion from the operand types to the resulting value:
- Unary `+` and `-` have the type of their promoted argument, so `-1U` is an unsigned value: a large positive integer rather than a negative one. section 5.4
- Decimal and hexadecimal literals can differ: `-2147483648` can fit a signed `int`, whereas `-0x80000000` effectively remains the unsigned value `2147483648`. section 5.4
- Mixed signedness changes comparisons: `-1 < 0` is true, but `-1 < 0U` is false because the operands undergo different conversion rules. section 5.4
- Pointer conversions are narrower: data pointers may convert to or from `void*`, or add a qualifier, but incompatible pointer types remain erroneous or dangerous. section 12.5
Inspecting object bytes
A conversion to `unsigned char*` must be explicit when inspecting an object's representation. Casting the address of an unsigned integer, then indexing through the resulting pointer, exposes its bytes; the observed order depends on the platform. section 12.5



