![]() |
![]() |
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 */
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |