Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC++2008-2-10-5

In this section:
Synopsis

(Advisory) The identifier name of a non-member object or function with static storage duration should not be reused.

Enabled by default

No

Severity/Certainty

Low/Medium

lowmedium.png
Full description

An identifier is used that might clash with another static identifier. This check is identical to MISRAC2004-5.5.

Coding standards
MISRA C:2004 5.5

(Advisory) No object or function identifier with static storage duration should be reused.

Code examples

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

namespace NS1
{
  static int global = 0;
}

namespace NS2
{
  void fn()
  {
    int global; // Non-compliant
  }
}

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

namespace NS1
{
  int global = 0;
}

namespace NS2
{
  void f1()
  {
    int global; // Non-compliant
  }
}

void f2()
{
  static int global;
}