Changeset ff2d1139

Feb 12, 2018, 2:38:55 PM (5 years ago)
Thierry Delisle <tdelisle@…>
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
7a052e34, b69ea6b, e6e3445
2fdbb3b (diff), ee2938a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.

Merge branch 'master' of

1 edited


  • doc/papers/general/Paper.tex

    r2fdbb3b rff2d1139  
    10441044The implicit targets of the current @continue@ and @break@, \ie the closest enclosing loop or @switch@, change as certain constructs are added or removed.
    1046 \TODO{choose and fallthrough here as well?}
     1046\subsection{\texorpdfstring{Enhanced \LstKeywordStyle{switch} Statement}{Enhanced switch Statement}}
     1048\CFA also fixes a number of ergonomic defecits in the @switch@ statements of standard C.
     1049C can specify a number of equivalent cases by using the default ``fall-through'' semantics of @case@ clauses, \eg @case 1: case 2: case 3:@ -- this syntax is cluttered, however, so \CFA includes a more concise list syntax, @case 1, 2, 3:@.
     1050For contiguous ranges, \CFA provides an even more concise range syntax as well, @case 1~3:@; lists of ranges are also allowed in case selectors.
     1052Forgotten @break@ statements at the end of @switch@ cases are a persistent sort of programmer error in C, and the @break@ statements themselves introduce visual clutter and an un-C-like keyword-based block delimiter.
     1053\CFA addresses this error by introducing a @choose@ statement, which works identically to a @switch@ except that its default end-of-case behaviour is to break rather than to fall through for all non-empty cases.
     1054Since empty cases like @case 7:@ in @case 7: case 11:@ still have fall-through semantics and explicit @break@ is still allowed at the end of a @choose@ case, many idiomatic uses of @switch@ in standard C can be converted to @choose@ statements by simply changing the keyword.
     1055Where fall-through is desired for a non-empty case, it can be specified with the new @fallthrough@ statement, making @choose@ equivalently powerful to @switch@, but more concise in the common case where most non-empty cases end with a @break@ statement, as in the example below:
     1058choose( i ) {
     1059        case 2:
     1060                printf("even ");
     1061                fallthrough;
     1062        case 3: case 5: case 7:
     1063                printf("small prime\n");
     1064        case 4,6,8,9:
     1065                printf("small composite\n");
     1066        case 13~19:
     1067                printf("teen\n");
     1068        default:
     1069                printf("something else\n");
    10491073\subsection{\texorpdfstring{\LstKeywordStyle{with} Clause / Statement}{with Clause / Statement}}
Note: See TracChangeset for help on using the changeset viewer.