AUTOSAR C++14 Rule A3-1-4
When an array with external linkage is declared, its size shall be stated explicitly
Description
Rule Definition
When an array with external linkage is declared, its size shall be stated explicitly.
Rationale
Declaring an array with external linkage without specifying its size and then attempting to access elements of the array can result in an array index out of bounds error. To reduce the possibility of such errors, specify the size of an array in its declaration.
Polyspace Implementation
Polyspace® reports a violation of this rule if all of these conditions are true:
You declare an
extern
array.The array is not initialized.
The number of elements for the array is not explicitly stated.
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: Required, Automated |
Version History
Introduced in R2019a