MISRA C++:2008 Rule 3-2-4
An identifier with external linkage shall have exactly one definition
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
An identifier with external linkage shall have exactly one definition.
Rationale
If an identifier has multiple definitions or no definitions, it can lead to undefined behavior.
Polyspace Implementation
Polyspacereports a variable if any of these conditions are true:
You specify multiple definitions or tentative definitions of a symbol.
There are undefined global variables in your code.
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: Basic Concepts |
Category: Required |
Version History
Introduced in R2013b