[previous] 1044 [next] [E] Defining an anonymous struct object. This is a language extension.
Language extensions

This is a declaration of an anonymous structure. This is a language extension.

An anonymous struct is an unnamed object of an unnamed struct type. The names of the members of an anonymous struct must be distinct from the names of any other ordinary identifiers in the scope in which the anonymous struct is declared. The members of an anonymous struct are treated as ordinary objects within the scope in which the anonymous struct is declared and can be addressed as ordinary objects.

For example:


/*PRQA S 750,2017,3132,3227,3408 ++*/

struct                                                       /* Message 1044 */
{
    unsigned short us;
    unsigned char  uc[2];
};

extern void foo(unsigned short usx)
{
    us = usx;
}


MISRA C:2012 Rules applicable to message 1044:

Rule-1.2  (Advisory) Language extensions should not be used


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