ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since a16d833 was
377e33f,
checked in by Peter A. Buhr <pabuhr@…>, 7 years ago
|
add if-conditional declarations test
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | // -*- Mode: C -*- |
---|
2 | // |
---|
3 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
4 | // |
---|
5 | // The contents of this file are covered under the licence agreement in the |
---|
6 | // file "LICENCE" distributed with Cforall. |
---|
7 | // |
---|
8 | // ifcond.c -- |
---|
9 | // |
---|
10 | // Author : Peter A. Buhr |
---|
11 | // Created On : Sat Aug 26 10:13:11 2017 |
---|
12 | // Last Modified By : Peter A. Buhr |
---|
13 | // Last Modified On : Sat Aug 26 11:13:00 2017 |
---|
14 | // Update Count : 11 |
---|
15 | // |
---|
16 | |
---|
17 | #include<fstream> |
---|
18 | |
---|
19 | int f( int r ) { return r; } |
---|
20 | |
---|
21 | int main( void ) { |
---|
22 | int x = 4, y = 3; |
---|
23 | |
---|
24 | if ( int x = 1 ) { |
---|
25 | sout | "x != 0 correct" | endl; |
---|
26 | } else { |
---|
27 | sout | "x == 0 incorrect" | endl; |
---|
28 | } // if |
---|
29 | |
---|
30 | if ( int x = 4, y = 0 ) { // FIXME && distribution |
---|
31 | sout | "x != 0 && y != 0 correct" | endl; |
---|
32 | } else { |
---|
33 | sout | "x != 0 && y == 0 incorrect" | endl; |
---|
34 | } // if |
---|
35 | |
---|
36 | if ( int x = 5, y = f( x ); x == y ) { |
---|
37 | sout | "x == y correct" | endl; |
---|
38 | } else { |
---|
39 | sout | "x != y incorrect" | endl; |
---|
40 | } // if |
---|
41 | } // main |
---|
42 | |
---|
43 | // Local Variables: // |
---|
44 | // tab-width: 4 // |
---|
45 | // compile-command: "cfa ifcond.c" // |
---|
46 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.