MISRAC++2023-6.0.1_a
In this section:
Synopsis
(Required) Block scope declarations shall not be visually ambiguous
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
Function declaration in block scope This check is identical to MISRAC++2008-3-1-2, MISRAC2004-8.6.
Coding standards
- MISRA C:2004 8.6
(Required) Functions shall be declared at file scope.
- MISRA C++ 2008 3-1-2
(Required) Functions shall not be declared at block scope.
Code examples
The following code example fails the check and will give a warning:
int foo() {
int bar();
return 0;
}
The following code example passes the check and will not give a warning about this issue:
int foo() {
return 0;
}
int bar();