Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC++2008-2-10-3

In this section:
Synopsis

(Required) A typedef name (including qualification, if any) shall be a unique identifier.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A typedef with this name has already been declared. This check is identical to MISRAC2004-5.3, MISRAC2012-Rule-5.6.

This is a link analysis check.

Coding standards
MISRA C:2004 5.3

(Required) A typedef name shall be a unique identifier.

MISRA C:2012 Rule-5.6

(Required) A typedef name shall be a unique identifier

Code examples

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

typedef int WIDTH;

void f1()
{
  WIDTH w1;
}

void f2()
{
  typedef float WIDTH;
  WIDTH w2;
  WIDTH w3;
}

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

namespace NS1
{
  typedef int WIDTH;
}
// f2.cc
namespace NS2
{
  typedef float WIDTH; // Compliant - NS2::WIDTH is not the same as NS1::WIDTH
}
NS1::WIDTH w1;
NS2::WIDTH w2;