[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:2012 Rules applicable to message 3684:

Rule-8.11  (Advisory) When an array with external linkage is declared, its size should be explicitly specified


See also:

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