Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2004-8.6

In this section:
Synopsis

(Required) Functions shall be declared at file scope.

Enabled by default

Yes

Severity/Certainty

Low/High

lowhigh.png
Full description

A function declaration was found at block scope. This check is identical to MISRAC++2008-3-1-2, MISRAC++2023-6.0.1_a.

Coding standards
MISRA C++ 2008 3-1-2

(Required) Functions shall not be declared at block scope.

MISRA C++ 2023 6.0.1

(Required) Block scope declarations shall not be visually ambiguous

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();