MISRA C:2023 Rule 5.2
Identifiers declared in the same scope and name space shall be distinct
Since R2024a
Description
Rule Definition
Identifiers declared in the same scope and name space shall be distinct.
Rationale
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 63 characters. In C90, the difference must occur between the first 31
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
.
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 R2024a