source:
src/examples/control_structures.c
@
00ede9e
Last change on this file since 00ede9e was 784deab, checked in by , 9 years ago | |
---|---|
|
|
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 | |
[784deab] | 12 | // Last Modified On : Mon Jan 4 11:30:30 2016 |
13 | // Update Count : 29 | |
[86bd7c1f] | 14 | // |
15 | ||
[784deab] | 16 | int main( void ) { |
[be5aa1b] | 17 | L1: { |
[a61fea9a] | 18 | L2: switch ( 3_333_333 ) { // underscores in constant |
19 | case 1,2,3: // CFA | |
20 | case 4~8: // CFA | |
21 | case 9 ... 10: // gcc, must have spaces | |
[be5aa1b] | 22 | L3: for ( ;; ) { |
23 | L4: for ( ;; ) { | |
[86bd7c1f] | 24 | break L1; // labelled break |
[be5aa1b] | 25 | break L2; |
26 | break L3; | |
27 | break L4; | |
[097e2b0] | 28 | //continue L1; // error: not enclosing loop |
29 | //continue L2; // error: not enclosing loop | |
[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 ) { | |
[a61fea9a] | 41 | case 1,2,3: |
42 | i = 3; | |
43 | 4; | |
44 | fallthru; | |
45 | case 4,5,6: | |
46 | j = 3; | |
47 | default: ; | |
[be5aa1b] | 48 | } // choose |
49 | } // block | |
[bdd516a] | 50 | |
51 | #if 0 | |
[be5aa1b] | 52 | try { |
53 | int i = 3; | |
54 | } catch( int ) { | |
55 | } catch( double ) { | |
56 | } catch( ... ) { | |
57 | } finally { | |
58 | } // try | |
[bdd516a] | 59 | #endif |
60 | ||
61 | } // main | |
62 | ||
63 | // Local Variables: // | |
[86bd7c1f] | 64 | // tab-width: 4 // |
65 | // compile-command: "cfa control_structures.c" // | |
[bdd516a] | 66 | // End: // |
Note: See TracBrowser
for help on using the repository browser.