MISRA C++:2008 Rule 2-10-5
The identifier name of a non-member object or function with static storage duration should not be reused
Description
Rule Definition
The identifier name of a non-member object or function with static storage duration should not be reused.
Rationale
Reusing the name of an identifier with static storage duration makes the code confusing and difficult to maintain. You might use the wrong identifier in your code and introduce bugs that are difficult to fix.
The rule applies even if the identifiers belong to different namespaces because the reuse leaves the chance that you mistake one identifier for the other.
Polyspace Implementation
The rule flags situations where the name of an identifier with static storage duration is reused. The rule checker flags redefined functions only when there is a declaration.
The checker is not raised on unused code such as
Noninstantiated templates
Uncalled
static
orextern
functionsUncalled and undefined local functions
Unused types and variables
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Lexical Conventions |
Category: Advisory |