Versions Compared

Key

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

...

This recommendation is a specific case of MSC12-C. Detect and remove code that has no effect or is never executed.

Noncompliant Code Example

...

Tool

Version

Checker

Description

CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

LANG.STRUCT.UVAL

Unused Value

Coverity

Include Page
Coverity_V
Coverity_V

UNUSED_VALUE

Finds variables that are assigned pointer values returned from a function call but never used

Klocwork

Include Page
Klocwork_V
Klocwork_V

 

Can detect violations of this rule with a number of checkers

LDRA tool suite

Include Page
LDRA_V
LDRA_V

1 D
70 D
94 D
15 D

Fully implemented

PRQA QA-C
Include Page
PRQA QA-C_Vv
PRQA QA-C_Vv

3195
3197
3198
3199
1500,1502,3203,3205,3206,3207,3229,3196, 2980,2981,2982,2983,2984,2985,2986

Fully implemented

Related Vulnerabilities

...

Related Guidelines

CERT C++ Secure Coding StandardMSC13-CPP. Detect and remove unused values
ISO/IEC TR 24772Likely Incorrect Expressions [KOA]
Dead and Deactivated Code [XYQ]
Unused Variable [XYR]

...