Main Content
MISRA C++:2023 Rule 10.0.1
A declaration should not declare more than one variable or member variable
Since R2024b
Description
Rule Definition
A declaration should not declare more than one variable or member variable.
Rationale
Declaring more than one variable in a declaration statement can make the code confusing to read and makes determining the variable type more difficult. Declare each variable using a separate declaration statement.
Polyspace Implementation
Polyspace® reports a violation if you declare more than one variable in a single declaration.
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: Declarations |
Category: Advisory |
Version History
Introduced in R2024b