Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC++2023-10.2.2 (C++ only)

In this section:
Synopsis

(Advisory) Unscoped enumerations should not be declared

Enabled by default

No

Severity/Certainty

Medium/High

mediumhigh.png
Full description

Unscoped enumerations may hide entities declared in an outer scope leading to confusion. It is allowed to have an unscoped enumeration as a class member.

Coding standards

This check does not correspond to any coding standard rules.

Code examples

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

enum Example : int // Non-compliant
{ 
  E0, 
  E1, 
  E2 
};

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

enum class Example : int // Compliant
{ 
  E0, 
  E1, 
  E2 
};