Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC++2008-3-2-2

In this section:
Synopsis

(Required) The One Definition Rule shall not be violated.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Found entity with multiple definitions. This check is identical to MISRAC++2023-6.2.1.

This is a link analysis check.

Coding standards
MISRA C++ 2023 6.2.1

(Required) The one-definition rule shall not be violated

Code examples

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

// File 1
struct S1 {
  int i;
};

// File 2
struct S1 {
  float i;
};

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

// File 1
struct S1i {
  int i;
};

// File 2
struct S1f {
  float i;
};