source:
tests/expression.cfa
@
f8a7fed
Last change on this file since f8a7fed was 6ca0dab, checked in by , 4 years ago | |
---|---|
|
|
File size: 1.0 KB |
Rev | Line | |
---|---|---|
[948fdef] | 1 | struct S { int i; }; |
[e56eb455] | 2 | void ?{}( S & s, int i ) { s.i = i; } |
[948fdef] | 3 | int ?`mary( int ); |
4 | int ?`mary( S ); | |
5 | [int] ?`mary( [int, int] ); | |
[33a484f] | 6 | int & ?`jane( int & ); |
[948fdef] | 7 | int jack( int ); |
8 | ||
[a0dcd2e] | 9 | int main() { |
[66812dd] | 10 | int a[3] = { 0, 0, 0 }; |
11 | S s = { 3 }, * ps = &s; | |
12 | [int] t = { 3 }; | |
13 | * [int] pt = &t; | |
14 | int i = 1, j = 2; | |
[62edde5] | 15 | |
[66812dd] | 16 | // operators |
[62edde5] | 17 | |
[66812dd] | 18 | !i; |
19 | ~i; | |
20 | +i; | |
21 | -i; | |
22 | *ps; | |
23 | ++ps; | |
24 | --ps; | |
25 | ps++; | |
26 | ps--; | |
[948fdef] | 27 | |
[66812dd] | 28 | i + j; |
29 | i - j; | |
30 | i * j; | |
[948fdef] | 31 | |
[66812dd] | 32 | i / j; |
33 | i % j; | |
34 | i ^ j; | |
35 | i & j; | |
36 | i | j; | |
37 | i < j; | |
38 | i > j; | |
39 | i = j; | |
[948fdef] | 40 | |
[66812dd] | 41 | i == j; |
42 | i != j; | |
43 | i << j; | |
44 | i >> j; | |
45 | i <= j; | |
46 | i >= j; | |
47 | i && j; | |
48 | i || j; | |
49 | ps->i; | |
[948fdef] | 50 | |
[66812dd] | 51 | i *= j; |
52 | i /= j; | |
53 | i %= j; | |
54 | i += j; | |
55 | i -= j; | |
56 | i &= j; | |
57 | i |= j; | |
58 | i ^= j; | |
59 | i <<= j; | |
60 | i >>= j; | |
[948fdef] | 61 | |
[66812dd] | 62 | i ? i : j; |
[948fdef] | 63 | |
[66812dd] | 64 | // postfix function call |
[948fdef] | 65 | |
[66812dd] | 66 | (3 + 4)`mary; |
67 | ({3 + 4;})`mary; | |
68 | [3, 4]`mary; | |
69 | 3`mary; | |
70 | a[0]`mary; | |
71 | a[0]`mary`mary; | |
72 | s{0}`mary; | |
73 | a[3]`jane++; | |
74 | jack(3)`mary; | |
75 | s.i`mary; | |
76 | t.0`mary; | |
77 | s.[i]`mary; | |
78 | ps->i`mary; | |
79 | pt->0`mary; | |
80 | ps->[i]`mary; | |
81 | i++`mary; | |
82 | i--`mary; | |
83 | (S){2}`mary; | |
84 | (S)@{2}`mary; | |
85 | ||
[6ca0dab] | 86 | #if !defined(NO_COMPILED_PRAGMA) |
87 | #pragma message( "Compiled" ) // force non-empty .expect file | |
88 | #endif | |
[a0dcd2e] | 89 | } // main |
Note: See TracBrowser
for help on using the repository browser.