[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:2004 Rules applicable to message 1044:

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


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