MISRAC++2023-0.2.1
In this section:
Synopsis
(Advisory) Variables with limited visibility should be used at least once
Enabled by default
No
Severity/Certainty
Low/Medium

Full description
Found unused variable
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:
class Unused { }; // No user-provided constructor or destructor
namespace
{
Unused c; // Non-compliant - unused
}
void example() {
}
The following code example passes the check and will not give a warning about this issue:
class Used {
public:
void DoSomething() { };
};
namespace
{
Used c; // Compliant - used
}
void example() {
c.DoSomething();
}