The C Standard defines octal constants as a 0 followed by octal digits (0 1 2 3 4 5 6 7).
This can lead to programming errors Programming errors can occur when decimal values are mistakenly specified as octal constants.
...
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.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL18-C | low | unlikely | low | P3 | L3 |
Related Guidelines
MISRA-C | Rule 7.1 |
---|
Bibliography
...
] | Section 6.4.4.1 "Integer constants" |
---|
...
MISRA Section 6.7, Rule 7.1
...