...
In this noncompliant code example, a decimal constant is mistakenly prefaced with zeros so that all the constants are a fixed length.:
Code Block | ||||
---|---|---|---|---|
| ||||
i_array[0] = 2719; i_array[1] = 4435; i_array[2] = 0042; |
...
To avoid using wrong values and to make the code more readable, do not preface constants with zeroes if the value is meant to be decimal.:
Code Block | ||||
---|---|---|---|---|
| ||||
i_array[0] = 2719; i_array[1] = 4435; i_array[2] = 42; |
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL18-C | low | unlikely | low | P3 | L3 |
Related Guidelines
MISRA - C:2012 | Rule 74.1 (required) |
...