MISRA C:2012 Rule 5.1
External identifiers shall be distinct
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
External identifiers shall be distinct1 .
Rationale
External identifiers are ones declared with global scope or
storage class extern
.
If the two long names are almost identical and differ only in the later part, they can be easily mistaken for each other. The readability of the code is reduced.
Polyspace Implementation
Polyspace considers two names as distinct if there is a difference between their
first 31 characters. For C90, the difference must occur between the first 6
characters. To use the C90 rules checking, use the value c90
for
the option C
standard version (-c-version)
. You can change the number of
characters compared using the option
-code-behavior-specifications
. See -code-behavior-specifications
.
Additional Message in Report
External %s %s
conflicts with the external
identifier XX in file YY.
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: Identifiers |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2014b
See Also
MISRA C:2012 Rule 5.2
| MISRA C:2012 Rule 5.4
| MISRA C:2012 Rule 5.5
| Check MISRA C:2012 (-misra3)
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.