mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-03 07:29:37 +00:00
c5f260e882
- Added test cases. - Reworked parser. - Added code redesign to avoid crashes in Initializers.java.
29 lines
421 B
C
29 lines
421 B
C
// More extensive union with C99 style designator initialization behaviour using const expressions.
|
|
|
|
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;
|
|
};
|
|
|
|
const struct Move move = {1,2,3};
|
|
|
|
union Data data = { .m=move };
|
|
|
|
char* const SCREEN = (char*)0x0400;
|
|
|
|
void main() {
|
|
SCREEN[0] = data.m.f;
|
|
} |