ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since dcf1979 was
dc8511c,
checked in by Peter A. Buhr <pabuhr@…>, 6 years ago
|
first attempt at updating suffixes for test programs
|
-
Property mode set to
100644
|
File size:
914 bytes
|
Line | |
---|
1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2016 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 | // counter.cfa -- |
---|
8 | // |
---|
9 | // Author : Aaron B. Moss |
---|
10 | // Created On : Thu Feb 22 15:27:00 2018 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Tue Nov 6 17:50:23 2018 |
---|
13 | // Update Count : 2 |
---|
14 | // |
---|
15 | |
---|
16 | // Tests unified increment/decrement builtin functions. |
---|
17 | // Could be extended for other arithmetic unifications |
---|
18 | |
---|
19 | struct counter { int x; }; |
---|
20 | |
---|
21 | counter& ?+=?( counter& c, one_t ) { ++c.x; return c; } |
---|
22 | |
---|
23 | counter& ?-=?( counter& c, one_t ) { --c.x; return c; } |
---|
24 | |
---|
25 | int main() { |
---|
26 | counter c = { 42 }; |
---|
27 | c += 1; |
---|
28 | ++c; |
---|
29 | c++; |
---|
30 | printf("%d\n", c.x); |
---|
31 | c -= 1; |
---|
32 | --c; |
---|
33 | c--; |
---|
34 | printf("%d\n", c.x); |
---|
35 | } |
---|
36 | |
---|
37 | // Local Variables: // |
---|
38 | // tab-width: 4 // |
---|
39 | // compile-command: "cfa counter.cfa" // |
---|
40 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.