Main Content
MISRA C++:2023 Rule 6.0.2
When an array with external linkage is declared, its size should be explicitly specified
Since R2024b
Description
Rule Definition
When an array with external linkage is declared, its size should be explicitly specified.
Rationale
Though you can declare an incomplete array type and later complete the type, specifying the array size during the first declaration makes the subsequent array access less error-prone.
Polyspace Implementation
Polyspace® reports a violation of this rule if you declare an external array without specifying its size.
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: Basic Concepts |
Category: Advisory |
Version History
Introduced in R2024b