[previous] 0941 [next] [C] A variable length array may not be initialized.
Constraint violations REFERENCE - ISO:C99-6.7.8 Initialization - Constraints

This is a constraint error

When an array is defined with variable length, it is not permitted to specify an initializer. For example:


/* PRQA S 1051,2213,2215,3122,3205,3227,3408,3604,3625 ++ */

void foo(int n)
{
    char bc1[n] = {0};            /* Message 0941 */
    char bc2[n] = "<DEFAULT>";    /* Message 0941 */
}


MISRA-C:2004 Rules applicable to message 0941:

Rule  1.1  (Required) All code shall conform to ISO/IEC 9899:1990 C programming language, ISO 9899, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192


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