ADTast-experimentalpthread-emulation
Last change
on this file since a0dbf20 was
200fcb3,
checked in by Peter A. Buhr <pabuhr@…>, 6 years ago
|
add auto newline to sout, change endl to nl
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
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 | // shortCircuit.cfa -- |
---|
8 | // |
---|
9 | // Author : Peter A. Buhr |
---|
10 | // Created On : Thu Jan 28 18:26:16 2016 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Tue Dec 4 18:26:05 2018 |
---|
13 | // Update Count : 4 |
---|
14 | // |
---|
15 | |
---|
16 | void g( float f ) {} |
---|
17 | void g( int i ) {} |
---|
18 | |
---|
19 | void f( int a ) { |
---|
20 | int b; |
---|
21 | float c; |
---|
22 | g( a ? b : c ); |
---|
23 | g( a && c ); |
---|
24 | g( a || b ); |
---|
25 | } |
---|
26 | |
---|
27 | void g() { |
---|
28 | int a; |
---|
29 | struct { int b; } a; |
---|
30 | if ( a ) { |
---|
31 | while ( a ) { |
---|
32 | int *b; |
---|
33 | for ( b; a; b ) { |
---|
34 | } |
---|
35 | } |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | #include <fstream.hfa> |
---|
40 | |
---|
41 | struct test_t { |
---|
42 | int x; |
---|
43 | }; |
---|
44 | |
---|
45 | int ?!=?( test_t lhs, int rhs ) { |
---|
46 | sout | lhs.x | " "; |
---|
47 | return lhs.x != 0; |
---|
48 | } |
---|
49 | |
---|
50 | int main( int argc, char const *argv[] ) { |
---|
51 | sout | nlOff; |
---|
52 | test_t true_val, false_val; |
---|
53 | true_val.x = 1; |
---|
54 | false_val.x = 0; |
---|
55 | |
---|
56 | true_val && false_val; |
---|
57 | sout | nl; |
---|
58 | |
---|
59 | true_val || false_val; |
---|
60 | sout | nl; |
---|
61 | |
---|
62 | false_val && true_val; |
---|
63 | sout | nl; |
---|
64 | |
---|
65 | false_val || true_val; |
---|
66 | sout | nl; |
---|
67 | |
---|
68 | return 0; |
---|
69 | } |
---|
70 | |
---|
71 | // Local Variables: // |
---|
72 | // tab-width: 4 // |
---|
73 | // compile-command: "cfa abs.cfa" // |
---|
74 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.