Synopsis: | Unsafe implicit conversions of literals shall be avoided. |
Language: | C |
Severity Level: | 8 |
Category: | Conversions |
Description: |
Justification Implicit conversions may be complex or unclearly defined. Unsafe implicit conversions should be avoided because values can be truncated or sign can be lost. When unsafe conversions are needed they shall be specified explicitly. Example void foo(int si) { if (si < 0x8000U) /* int converted to unsigned for comparison */ ... } |