A mixed-sign comparison
-1 < 0 // true -1U < 0U // false -1 < 0U // false; dangerous mixed signedness The operands' types can silently change a value before comparison. These numeric C types are arithmetic types: integer, floating-point, and complex types. section 5.4
Arithmetic types represent numeric values, but combining them can trigger implicit conversions. Signed and unsigned operands are especially hazardous because a negative value may become a large unsigned value. section 5.4
TAKEAWAY
- Avoid operations whose operands have different signedness. section 5.4
- Choose arithmetic types so that implicit conversions remain harmless. section 5.4
