source: src/Tests/Syntax/Initialization.c @ 843054c2

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 843054c2 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 752 bytes
Line 
1// Cforall extensions
2
3int * v1 = 0, v2 = 0;
4int * v3 = 0, v4 = 0;
5
6void fred() {
7    int y1, y2[20]  = { 1, 2, 3 };
8
9    // designators
10
11    struct {
12        [int] w;
13    } a = { .w : [2] };
14
15    struct { int a[3], b; } w [] = { [0].a : {1}, [0].b : 1, [1].a[0] : 2 };
16
17    struct {
18        int f1, f2, f3;
19        struct { int g1, g2, g3; } f4[4];
20    } v7 = {
21        .f1 : 4,
22        .f2 : 3,
23        .f4[2] : {
24            .g1 : 3,
25            .g3 : 0,
26        },
27        .f4[3].g3 : 7,
28    };
29}
30
31struct point { int x; int z; struct {int y1, y2, y3;} y; int w;};
32struct quintet { int v, w, x, y, z;};
33
34int foo() {
35  return 4;
36}
37
38int main() {
39  foo();
40  int i;
41  struct point p1 = { x: 3 };
42  struct point p2 = { 3, 4 };
43  struct point p3 = { .[x,z]: 5, y : { .[y3,y1] : 6, 17 } };
44  struct point p4 = { w : 5, 4 };
45}
Note: See TracBrowser for help on using the repository browser.