[previous] MISRA-C:2004  Rule  8.12:  (Required) [next] When an array is declared with external linkage, its size shall be stated explicitly or defined implicitly by initialisation.

int array1[ 10 ];                          /* Compliant     */
extern int array2[ ];                      /* Not compliant */
int array2[ ] = { 0, 10, 15 };             /* Compliant     */

Although it is possible to declare an array of incomplete type and access its elements, it is safer to do so when the size of the array may be explicitly determined.


QAC messages that encompass this guideline:

3684 Array declared with unknown size.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents