When an array with external linkage is declared, its size should be explicitly specified
When an array with external linkage is declared, its size should be explicitly specified.
Although it is possible to declare an array with an incomplete type and access its elements, it is safer to state the size of the array explicitly. If you provide size information for each declaration, a code reviewer can check multiple declarations for their consistency. With size information, a static analysis tool can perform array bounds analysis without analyzing more than one unit.
The rule checker flags arrays declared with the extern
specifier if the declaration does not explicitly specify the array size.
Size of array array_name should be explicitly stated. When an array
with external linkage is declared, its size should be explicitly specified.
If you expect a rule violation but do not see it, refer to the documentation of Polyspace® Code Prover™ or Polyspace Code Prover Server™.
| Group: Declarations and Definitions |
| Category: Advisory |
| AGC Category: Advisory |