MISRA C:2023 Rule 8.6
An identifier with external linkage shall have exactly one external definition
Since R2024a
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 external definition.
Rationale
If you use an identifier for which multiple definitions exist in different files or no definition exists, the behavior is undefined.
Multiple definitions in different files are not permitted by this rule even if the definitions are the same.
Polyspace Implementation
The checker flags multiple definitions only if the definitions occur in different files.
The checker does not consider tentative definitions as definitions. For instance, the following code does not violate the rule:
int val; int val=1;
The checker does not show a violation if a function is not defined at all but declared with external linkage and called in the source code.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Declarations and Definitions |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2024a