V2501. MISRA. Octal constants should not be used.

This diagnostic rule is based on the software development guidelines developed by MISRA (Motor Industry Software Reliability Association).

This diagnostic rule varies for C and C++.

C: octal numeric literals should not be used.

C++: octal numeric literals and escape sequences should not be used.

The use of octal literals could hinder code readability, especially when skimming through it. Misinterpreting numeric values may result in various mistakes.

Here is an example of code triggering this warning:

if (val < 010)

When skimming through the code, you may overlook the actual value of the numeric literal, which is 8, not 10. To eliminate this warning, rewrite the literal in decimal or hexadecimal form:

if (val < 8)

Bugs Found

Checked Projects
Collected Errors
13 764