AUTOSAR C++14 Rule M2-13-2
Octal constants (other than zero) and octal escape sequences (other than "\0" ) shall not be used
Description
Rule Definition
Octal constants (other than zero) and octal escape sequences (other than "\0" ) shall not be used.
Rationale
Octal constants are denoted by a leading zero. A developer or code reviewer can mistake an octal constant as a decimal constant with a redundant leading zero.
Octal escape sequences beginning with \
can also cause
confusion. Inadvertently introducing an 8 or 9 in the digit sequence after
\
breaks the escape sequence and introduces a new digit. A
developer or code reviewer can ignore this issue and continue to treat the escape
sequence as one digit.
Polyspace Implementation
The rule checker reports violations on:
Constants beginning with a leading zero.
Escape sequences that begin with a
\
followed by a zero.
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Lexical Conventions |
Category: Required, Automated |
Version History
Introduced in R2019a