This diagnostic rule is based on the software development guidelines developed by AUTOSAR (AUTomotive Open System ARchitecture).
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)
{
....
}
This is exactly the case when a reply to a comment turned into a small blog post. The power of ...