source: tests/tuple/tupleMember.cfa @ 1205b3e

ADTast-experimental
Last change on this file since 1205b3e was 107b01a, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Several changes to the makefiles

  • change .c tests to .cfa
  • add require for libtool in configure
  • libtoolize to fix some warnings
  • Property mode set to 100644
File size: 1.2 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// tupleFunction.c --
8//
9// Author           : Rob Schluntz
10// Created On       : Tue Nov 15 17:24:32 2016
11// Last Modified By : Rob Schluntz
12// Last Modified On : Tue Nov 15 17:27:28 2016
13// Update Count     : 3
14//
15
16void f() {
17        printf("called f!\n");
18}
19
20double g(double x, char y, int z) {
21        return z-y+x;
22}
23
24struct V2       {
25        int f2, f3;
26};
27struct V {
28        int f1;
29        V2 i; // temporary
30        // struct V2 {
31        //   int f2, f3;
32        // } i;
33        double f4;
34} v;
35
36V & h() {
37        static V local = { 111, { 222, 333 }, 444.5 };
38        return local;
39}
40
41int main() {
42        struct X {
43                int a;
44                double b;
45                char c;
46        } x = { 10, 12.5, '\x9' };
47
48        // should only call f once
49        printf("g(...)=%lg\n", g((f(), x).[b, c, a]));
50
51        v.[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [11, 3.14159, 12, 13];
52
53        printf("v.[f1, i.[f2, f3], f4]=[%d, %d, %d, %lg]\n", v.[f1, i.[f2, f3], f4]);
54
55        h().[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [987, 6.28, 4, 2];
56        printf("v.[f1, i.[f2, f3], f4]=[%d, [%d, %d], %lg]\n", h().[f1, i.[f2, f3], f4]);
57}
58
59// Local Variables: //
60// tab-width: 4 //
61// End: //
Note: See TracBrowser for help on using the repository browser.