ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 1136d96 was
4162aea9,
checked in by Rob Schluntz <rschlunt@…>, 9 years ago
|
documentation and update control_structures.c example
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[86bd7c1f] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 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 | // control_structures.c -- |
---|
| 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Wed May 27 17:56:53 2015 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
| 12 | // Last Modified On : Wed May 27 18:07:42 2015 |
---|
| 13 | // Update Count : 1 |
---|
| 14 | // |
---|
| 15 | |
---|
[bdd516a] | 16 | int main() { |
---|
[be5aa1b] | 17 | L1: { |
---|
[86bd7c1f] | 18 | L2: switch ( 3_333_333 ) { // underscores in constant |
---|
| 19 | case 1,2,3: // 4~8, 4...8 not working |
---|
[4162aea9] | 20 | case 4~8: |
---|
[be5aa1b] | 21 | L3: for ( ;; ) { |
---|
| 22 | L4: for ( ;; ) { |
---|
[86bd7c1f] | 23 | break L1; // labelled break |
---|
[be5aa1b] | 24 | break L2; |
---|
| 25 | break L3; |
---|
| 26 | break L4; |
---|
| 27 | |
---|
[86bd7c1f] | 28 | //continue L1; // labelled continue - should be an error |
---|
| 29 | //continue L2; // should be an error |
---|
[be5aa1b] | 30 | continue L3; |
---|
| 31 | continue L4; |
---|
| 32 | } // for |
---|
| 33 | } // for |
---|
| 34 | break; |
---|
| 35 | default: |
---|
| 36 | break L1; |
---|
| 37 | } // switch |
---|
| 38 | 3; |
---|
| 39 | int i, j; |
---|
| 40 | choose ( 7 ) { |
---|
| 41 | case 1,2,3: |
---|
| 42 | i = 3; |
---|
| 43 | fallthru; |
---|
| 44 | case 4,5,6: |
---|
| 45 | j = 3; |
---|
| 46 | default: ; |
---|
| 47 | } // choose |
---|
| 48 | } // block |
---|
[bdd516a] | 49 | |
---|
| 50 | #if 0 |
---|
[be5aa1b] | 51 | try { |
---|
| 52 | int i = 3; |
---|
| 53 | } catch( int ) { |
---|
| 54 | } catch( double ) { |
---|
| 55 | } catch( ... ) { |
---|
| 56 | } finally { |
---|
| 57 | } // try |
---|
[bdd516a] | 58 | #endif |
---|
| 59 | |
---|
| 60 | } // main |
---|
| 61 | |
---|
| 62 | // Local Variables: // |
---|
[86bd7c1f] | 63 | // tab-width: 4 // |
---|
| 64 | // compile-command: "cfa control_structures.c" // |
---|
[bdd516a] | 65 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.