Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
langcpp
enum EnumType {
  First,
  Second,
  Third
};

void f(int intVar) {
  if (intVar < First || intVar > Third) {
    // Handle error
  }
  EnumType enumVar = static_cast<EnumType>(intVar);
}

Automated Detection

Tool

Version

Checker

Description

PRQA QA-C++4.12910, 2911, 2912, 2913 

Compliant Solution (Scoped Enumeration)

...