![]() |
![]() |
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:2012 Rules applicable to message 1041:
| Rule-1.2 (Advisory) | Language extensions should not be used |
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 |