![]() |
![]() |
1041 | ![]() |
||||
![]() | |||||||
| Language extensions | |||||||
An empty initialiser "{ }" has been used to initialize a struct or a union. This is a language extension. Empty "aggregate initializers" are supported by some compilers as a shorthand for "{ 0 }". They are also sometimes interpreted as a placeholder initialiser for empty structs or zero length arrays. For example:
/*PRQA S 1314,2017,2213,3132,3211,3408,3603 ++*/
extern int ea [2] = { }; /* Message 1041 */
extern int eb [0] = { }; /* Message 1041 and 1037 */
struct st1
{
int n;
struct st2 { } sa; /* Message 0633 */
};
extern struct st1 xs = {1, { }}; /* Message 1041 */
MISRA-C:2004 Rules applicable to message 1041:
| 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 |
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 |