1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-03 07:29:37 +00:00
kickc/src/test/kc/union-11.c
Flight_Control c5f260e882 Implemented C99 compatible union initializer method.
- Added test cases.
- Reworked parser.
- Added code redesign to avoid crashes in Initializers.java.
2023-04-04 09:30:40 +02:00

27 lines
386 B
C

// More extensive union with C99 style designator initialization behaviour of the first element.
struct Move {
char f;
char t;
char s;
};
struct Turn {
char t;
char s;
char r;
char d;
};
union Data {
struct Move m;
struct Turn t;
};
union Data data = { .m={1,2,3} };
char* const SCREEN = (char*)0x0400;
void main() {
SCREEN[0] = data.m.f;
}