Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 사용자 설명서
제품 코드
SW006021-1
C Language Features
2012 Microchip Technology Inc.
DS52053B-page 151
The MPLAB XC8 compiler supports anonymous unions. These are unions with no
identifier and whose members can be accessed without referencing the enclosing
union. These unions can be used when placing inside structures. For example:
identifier and whose members can be accessed without referencing the enclosing
union. These unions can be used when placing inside structures. For example:
struct {
union {
int x;
double y;
};
} aaa;
void main(void)
{
aaa.x = 99;
// ...}
Here, the union is not named and its members accessed as if they are part of the struc-
ture. Anonymous unions are not part of any C Standard and so their use limits the
portability of any code.
ture. Anonymous unions are not part of any C Standard and so their use limits the
portability of any code.