diff options
| author | 2025-10-08 23:03:06 +0200 | |
|---|---|---|
| committer | 2025-10-08 23:03:06 +0200 | |
| commit | 6436f4c576b65dd8220db7dcd0e7a21f33ac4933 (patch) | |
| tree | 7c06011b48019761151192f63140921610d2f036 /test/test.c | |
| parent | de0ff34465d9c6a34a359b0b05af1f5c34905c6c (diff) | |
initial implementation of run-time array/aggregate initializers
Diffstat (limited to 'test/test.c')
| -rw-r--r-- | test/test.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/test.c b/test/test.c index c44d1a0..1a50690 100644 --- a/test/test.c +++ b/test/test.c @@ -40,8 +40,7 @@ struct quad { }; struct quad quad(long x, long y, long z, long w) { - struct quad q; - q.x = x, q.y = y, q.z = z, q.w = w; + struct quad q = {x,y,z,w}; return q; } @@ -62,9 +61,11 @@ int test2(struct big *b) { struct f2 { float f,g; }; struct f2 f2test(struct f2 *r) { + struct f2 q = {1,3,.f=2}; + *r = q; return *r; } -#if 0 +#if 1 void fill(char *p, int c, unsigned long n) { int t; @@ -82,7 +83,7 @@ enum ball { X = 2147483647, Y, Z, - W = ~0ull + W = ~0ull //warn }; enum ball x; @@ -96,4 +97,13 @@ struct f{ char flex[]; }; #endif + +int main() { + char str[] = "abcdef!"; + int arr[] = {[4]=1,9001}; + str[1]&=~0x20; + extern int printf(char *, ...); + printf("%s %d,%d\n",str, arr[0],arr[5]); + return sizeof arr; +} // |