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

...

 

Compliant Solution (Scoped Enumeration)

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

INT50-CPP

Medium

Unlikely

Medium

P4

L3

Automated Detection

Tool

Version

Checker

Description

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

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...