MISRA C++:2008 Rule 3-2-2
The One Definition Rule shall not be violated
Description
This checker is deactivated in a default Polyspace® as You Code analysis. See Checkers Deactivated in Polyspace as You Code Analysis (Polyspace Access).
Rule Definition
The One Definition Rule shall not be violated.
Rationale
Violations of the One Definition Rule leads to undefined behavior.
Polyspace Implementation
The checker flags situations where the same function or object has multiple definitions and the definitions differ by some token. The checker is not raised on unused code such as
Noninstantiated templates
Uncalled
static
orextern
functionsUncalled and undefined local functions
Unused types and variables
Additional Message in Report
The One Definition Rule shall not be violated.
Declaration of class className
violates the One
Definition Rule:
it conflicts with other declaration (fileName
lineNumber
).
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: Basic Concepts |
Category: Required |
Version History
Introduced in R2013b