MISRA C:2012 Rule 5.5
Identifiers shall be distinct from macro names
Description
Rule Definition
Identifiers shall be distinct from macro names.
Rationale
The rule requires that macro names that exist only prior to processing must be different from identifier names that also exist after preprocessing. Keeping macro names and identifiers distinct help avoid confusion.
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
.
Additional Message in Report
Identifier XX has same significant characters as macro 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