![]() |
![]() |
1031 | ![]() |
||||
![]() | |||||||
| ISO C99 Language features | REFERENCE - ISO:C90-6.5.7 Initialization - Constraints | ||||||
An array, struct or union with automatic storage duration is being initialized with an initializer which is not a constant expression. This is not permitted in ISO:C90, but it IS allowed in ISO:C99. For example:
/*PRQA S 2017,2213,2216,3120,3132,3199,3205,3227,3408,3604,3674 ++*/
struct ST {int a; int b;};
extern void foo(int p1, int p2, int p3)
{
int var = p1; /* Scalar object - OK */
int buf1[] = {1, 2, 3};
int buf2[3]= {p1, p2, p3}; /* Message 1031 */
struct ST sx = {p1, p2}; /* Message 1031 */
}
MISRA C:2012 Rules applicable to message 1031:
| Dir-1.1 (Required) | Any implementation-defined behaviour on which the output of the program depends shall be documented and understood |
![]() | ||
| 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 |