Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC2004-16.4

In this section:
Synopsis

(Required) The identifiers used in the declaration and definition of a function shall be identical.

Enabled by default

Yes

Severity/Certainty

Low/High

lowhigh.png
Full description

The parameter names between the function declaration and definition does not match. This check is identical to MISRAC++2008-8-4-2_a, MISRAC++2023-13.3.3_a.

This is a link analysis check.

Coding standards
MISRA C++ 2008 8-4-2

(Required) The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration.

MISRA C++ 2023 13.3.3

(Required) The parameters in all declarations or overrides of a function shall either be unnamed or have identical names

Code examples

The following code example fails the check and will give a warning:

/* 
file2.c:
int foo(int b, int a);
 */
int foo(int a, int b)
{
  return a + b;
}

The following code example passes the check and will not give a warning about this issue:

/* 
file2.c:
int foo(int a, int b);
 */
int foo(int a, int b)
{
  return a + b;
}