mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
46 lines
768 B
C
46 lines
768 B
C
typedef Callback = fn int(char c);
|
|
struct Person { int i; }
|
|
struct Company { int j; }
|
|
enum Status : int
|
|
{
|
|
IDLE,
|
|
BUSY,
|
|
DONE,
|
|
}
|
|
|
|
struct MyData
|
|
{
|
|
char* name;
|
|
Callback open;
|
|
Callback close;
|
|
//Status status;
|
|
|
|
// named sub-structs (x.other.value)
|
|
struct other
|
|
{
|
|
int value;
|
|
int status; // ok, no name clash with other status
|
|
}
|
|
|
|
// anonymous sub-structs (x.value)
|
|
struct
|
|
{
|
|
int value;
|
|
int status; // error, name clash with other status in MyData
|
|
}
|
|
|
|
// anonymous union (x.person)
|
|
union
|
|
{
|
|
Person* person;
|
|
Company* company;
|
|
}
|
|
|
|
// named sub-unions (x.either.this)
|
|
union either
|
|
{
|
|
int this;
|
|
bool or;
|
|
char* that;
|
|
}
|
|
} |