MISRA C++:2008 Rule 8-0-1
An init-declarator-list or a member-declarator-list shall consist of a single init-declarator or member-declarator respectively
Description
Rule Definition
An init-declarator-list or a member-declarator-list shall consist of a single init-declarator or member-declarator respectively.
Rationale
Init-declarator-lists that have multiple declarators might result in ambiguous type assignments and might cause a developer to assign unintended types to certain identifiers. Having a single init-declarator for each declaration clarifies the declaration type and reduces the risk of unwanted type assignments. Avoid multiple declarators in an init-declarator-list or a member-declarator-list.
Polyspace Implementation
Polyspace® flags declarators after the first declarator in an init-declarator-list or a member-declarator-list.
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: Declarators |
Category: Required |
Version History
Introduced in R2013b