MISRAC2004-7.1
In this section:
Synopsis
(Required) Octal constants shall not be used. Zero is okay
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
Uses of octal integer constants were found. This check is identical to MISRAC++2008-2-13-2, MISRAC2012-Rule-7.1, MISRAC++2023-5.13.3.
Coding standards
- MISRA C:2004 7.1
(Required) Octal constants shall not be used. Zero is okay
- MISRA C:2012 Rule-7.1
(Required) Octal constants shall not be used
- MISRA C++ 2008 2-13-2
(Required) Octal constants (other than zero) and octal escape sequences (other than 0) shall not be used.
- MISRA C++ 2023 5.13.3
(Required) Octal constants shall not be used
Code examples
The following code example fails the check and will give a warning:
void
func(void)
{
int x = 077;
}
The following code example passes the check and will not give a warning about this issue:
void
func(void)
{
int x = 63;
}