Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC++2008-8-4-2_b (C++ only)

In this section:
Synopsis

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

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

Different names of the same parameter can lead to confusion when reading the code. This check is identical to MISRAC++2023-13.3.3_b.

Coding standards
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:

struct A {
  virtual void foo(int a);
};

struct B : public A {
  void foo(int b) override;
};

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

struct A {
  virtual void foo(int a);
};

struct B : public A {
  void foo(int a) override;
};

void B::foo(int) {
  // Do nothing
}