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