Rule Definition
Data members that are never read are useless. For maintenance and performance purpose they should be removed (with the code that write into those data members if any).
Remediation
Remove the data member and delete any code that write data in it.
Violation Code Sample
class C
{
protected int m_data = 0; // HERE m_data is only written and is never
void getPI() { m_data = 1; return 3.14159; }
}
Fixed Code Sample
class C
{
void getPI() { return 3.14159; }
}
Related Technologies
C++
Technical Criterion
Dead code (static)
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.