ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since cb2e8ce was
4e06c1e,
checked in by Peter A. Buhr <pabuhr@…>, 8 years ago
|
changes for switch and choose statements
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[4e06c1e] | 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 | // switch.c -- |
---|
| 8 | // |
---|
| 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Tue Jul 12 06:50:22 2016 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
| 12 | // Last Modified On : Tue Jul 12 18:02:23 2016 |
---|
| 13 | // Update Count : 22 |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | int f( int i ) { return i; } |
---|
| 17 | |
---|
| 18 | int main() { |
---|
| 19 | int i = 0; |
---|
| 20 | switch ( i ) case 3 : i = 1; |
---|
| 21 | switch ( i ) default : f( 3 ); |
---|
| 22 | |
---|
| 23 | switch ( 3 ) |
---|
| 24 | default: |
---|
| 25 | case 2: |
---|
| 26 | case 3: |
---|
| 27 | f( 3 ); |
---|
| 28 | |
---|
| 29 | switch ( i ) {} |
---|
| 30 | switch ( i ) { |
---|
| 31 | case 3: |
---|
| 32 | f( 3 ); |
---|
| 33 | } // switch |
---|
| 34 | |
---|
| 35 | // switch (3 ) { |
---|
| 36 | // int j; |
---|
| 37 | // case 3: |
---|
| 38 | // break; |
---|
| 39 | // case 4: |
---|
| 40 | // j = 0; |
---|
| 41 | // } |
---|
| 42 | |
---|
| 43 | switch ( i ) { |
---|
| 44 | int j = 0; |
---|
| 45 | int k = 0; |
---|
| 46 | struct S { int i; }; |
---|
| 47 | S s; |
---|
| 48 | case 8~10: |
---|
| 49 | default: |
---|
| 50 | i = 3; |
---|
| 51 | case 3: |
---|
| 52 | case 'A' ... 'Z': |
---|
| 53 | case 5 ... 6: |
---|
| 54 | case 2, 4: |
---|
| 55 | j = 3; |
---|
| 56 | f( 3 ); |
---|
| 57 | break; |
---|
| 58 | } // switch |
---|
| 59 | |
---|
| 60 | choose ( i ) case 3 : f( 3 ); |
---|
| 61 | choose ( i ) default : i = 1; |
---|
| 62 | |
---|
| 63 | choose ( 3 ) |
---|
| 64 | case 2: |
---|
| 65 | default: |
---|
| 66 | case 3: |
---|
| 67 | f( 3 ); |
---|
| 68 | |
---|
| 69 | choose ( i ) {} |
---|
| 70 | choose ( i ) { |
---|
| 71 | case 3: |
---|
| 72 | f( 3 ); |
---|
| 73 | } // choose |
---|
| 74 | |
---|
| 75 | choose ( i ) { |
---|
| 76 | int j = 0; |
---|
| 77 | int k = 0; |
---|
| 78 | struct S { int i; }; |
---|
| 79 | S s; |
---|
| 80 | case 3: |
---|
| 81 | case 'A' ... 'Z': |
---|
| 82 | case 5 ... 6: |
---|
| 83 | case 2, 4, 7: |
---|
| 84 | i = 3; |
---|
| 85 | f( 3 ); |
---|
| 86 | default: |
---|
| 87 | j = 3; |
---|
| 88 | case 8~10: |
---|
| 89 | f( 3 ); |
---|
| 90 | fallthru |
---|
| 91 | case 'd': |
---|
| 92 | j = 5; |
---|
| 93 | } // choose |
---|
[62edde5] | 94 | } |
---|
[4e06c1e] | 95 | |
---|
| 96 | // Local Variables: // |
---|
| 97 | // tab-width: 4 // |
---|
| 98 | // compile-command: "cfa switch.c" // |
---|
| 99 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.