[previous] 3684 [next] Array declared with unknown size.
Arrays, structures, unions and bit-fields

An array has been declared with incomplete type.

This is only allowed when the array has external linkage. Some coding standards deprecate this practice because it prevents tools from checking the validity of array subscript operations.

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 3684, 2840 --*/

extern int xa[10];
extern int xb[];                /* Message 3684 */

extern void foo(void)
{
    xa[10] = 0;                 /* Message 2840 - out of bounds */

    xb[10] = 0;                 /* No message - array size is unknown */
}


MISRA-C:2004 Rules applicable to message 3684:

Rule  8.12  (Required) When an array is declared with external linkage, its size shall be stated explicitly or defined implicitly by initialisation.


See also:

QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents