aboutsummaryrefslogtreecommitdiffhomepage
path: root/test.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-05-29 11:37:32 +0200
committerlemon <lsof@mailbox.org>2023-05-29 11:37:32 +0200
commit1c04435e5d33378ffa8eca65ca1ed35f3f9f4134 (patch)
treeeab923f7dde10ba1d71d8efe025891e743009203 /test.c
parent84824a0ed3a0cf90728078b74ca39778c51e60b9 (diff)
field access
Diffstat (limited to 'test.c')
-rw-r--r--test.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/test.c b/test.c
index 1d6c01f..9a3aafb 100644
--- a/test.c
+++ b/test.c
@@ -13,7 +13,31 @@ int add (int x, int y) {
return x + y + *glob;
}
-struct foo {struct foo *foo;};
+struct foo {
+ struct foo *foo;
+ struct n0 {
+ char z;
+ struct n1 {
+ char q;
+ struct n2 {
+ int ww;
+ } n2;
+ } n1;
+ } n0;
+ union {
+ struct { short x, y; };
+ int xy;
+ };
+ char flex[];
+};
+
+int foop(struct foo *foo) {
+ if (foo->foo) foo = foo->foo;
+ ++foo->n0.n1.n2.ww;
+ int xy = (*foo).xy;
+ foo->flex[2] *= 5;
+ if (foo->x)return xy; else return foo->y;
+}
int abs(int x){
return (x ^ x >> 3\