1 | int f( int, int ); |
---|
2 | int g( int, int, int ); |
---|
3 | static |
---|
4 | [ int, int *, * int, int ] h( int a, int b, * int c, [] char d ); |
---|
5 | |
---|
6 | struct inner { |
---|
7 | int f2, f3; |
---|
8 | }; |
---|
9 | |
---|
10 | struct outer { |
---|
11 | int f1; |
---|
12 | struct inner i; |
---|
13 | double f4; |
---|
14 | } s, *sp; |
---|
15 | |
---|
16 | const volatile [ int, int ] t1; |
---|
17 | static const [ int, int ] t2; |
---|
18 | const static [ int, const int ] t3; |
---|
19 | |
---|
20 | [ int rc ] printf( * char fmt, ... ); |
---|
21 | int printf( char *fmt, ... ); |
---|
22 | |
---|
23 | [ short x, unsigned y ] f1( int w ) { |
---|
24 | // return [ y, x ] = [ x, y ] = [ w, 23 ]; |
---|
25 | } |
---|
26 | |
---|
27 | [ [ int, char, long, int ] r ] g1() { |
---|
28 | short int x, p; |
---|
29 | unsigned int y; |
---|
30 | [ int, int ] z; |
---|
31 | |
---|
32 | [ x, y, z ] = [ p, f( 17, 18 ), 4, 3 ]; |
---|
33 | // [ x, y, z ] = ([short, unsigned int, [int, int]])([ p, f( 17, 18 ), 4, 3 ]); |
---|
34 | r = [ x, y, z ]; |
---|
35 | } |
---|
36 | |
---|
37 | [ int rc ] main( int argc, ** char argv ) { |
---|
38 | int a, b, c, d; |
---|
39 | // struct outer t = { .[ f1, f4 ] : [ 1, 7.0 ] }; |
---|
40 | f( [ 3,5 ] ); |
---|
41 | g( [ 3,5 ], 3 ); |
---|
42 | f( t1 ); |
---|
43 | g( t1, 3 ); |
---|
44 | |
---|
45 | // [ , , , ]; /* empty tuple */ |
---|
46 | [ 3, 5 ]; |
---|
47 | [ a, b ] = 3; |
---|
48 | [ a, b ] = [ 4.6 ]; |
---|
49 | [ a, b ] = 4.6; |
---|
50 | [ a, b ] = [ c, d ] = [ 3, 5 ]; |
---|
51 | // [ a, b, [ c ] ] = [ 2, [ a, b ] ]; |
---|
52 | [ a, b, c ] = [ 2, [ a, b ] ]; |
---|
53 | [ a, b ] = 3 > 4 ? [ b, 6 ] : [ 7, 8 ]; |
---|
54 | |
---|
55 | t1 = [ a, b ]; |
---|
56 | t1 = t2 = [ a, b ]; |
---|
57 | [ a, b ] = [ c, d ] = d += c += 1; |
---|
58 | [ a, b ] = [ c, d ] = t1; |
---|
59 | [ a, b ] = t1 = [ c, d ]; |
---|
60 | [ a, b ] = t1 = t2 = [ c, d ]; |
---|
61 | t1 = [ 3, 4 ] = [ 3, 4 ] = t1 = [ 3, 4 ]; |
---|
62 | |
---|
63 | s.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ]; |
---|
64 | // s.[ f1, i.[ f2, f3 ], f4 ] = h( 3, 3, (* int)0, "abc" ); |
---|
65 | // [ a, , b, ] = h( 3, 3, 0, "abc" ); /* ignore some results */ |
---|
66 | sp->[ f4, f1 ] = sp->[ f1, f4 ]; |
---|
67 | printf( "expecting 3, 17, 23, 4; got %g, %d, %d, %d\n", s.[ f4, i.[ f3, f2 ], f1 ] ); |
---|
68 | rc = 0; |
---|
69 | } |
---|
70 | |
---|
71 | // Local Variables: // |
---|
72 | // tab-width: 4 // |
---|
73 | // End: // |
---|