source: src/examples/control_structures.c @ be5aa1b

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 be5aa1b was be5aa1b, checked in by Rob Schluntz <rschlunt@…>, 9 years ago

error if continue statement targets a location that is not an enclosing loop, better error messages for branch statements with labels, formatting, refactoring

  • Property mode set to 100644
File size: 835 bytes
Line 
1int main() {
2        L1: {
3                L2: switch ( 3_333_333 ) {  // underscores in constant
4                        case 1,2,3:     // 4~8, 4...8 not working
5                                L3: for ( ;; ) {
6                                        L4: for ( ;; ) {
7                                                break L1;   // labelled break
8                                                break L2;
9                                                break L3;
10                                                break L4;
11
12                                                // continue L1; // labelled continue - should be an error
13                                                // continue L2; // should be an error
14                                                continue L3;
15                                                continue L4;
16                                        } // for
17                                } // for
18                                break;
19                        default:
20                                break L1;
21                } // switch
22                3;
23                int i, j;
24                choose ( 7 ) {
25                        case 1,2,3:
26                                i = 3;
27                                fallthru;
28                        case 4,5,6:
29                                j = 3;
30                        default: ;
31                } // choose
32        } // block
33
34#if 0
35        try {
36                int i = 3;
37        } catch( int ) {
38        } catch( double ) {
39        } catch( ... ) {
40        } finally {
41        } // try
42#endif
43
44} // main
45
46// Local Variables: //
47// compile-command: "../../bin/cfa control_structures.c" //
48// End: //
Note: See TracBrowser for help on using the repository browser.