Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Mention the C2x and GNU attributes

...

MSC17-C-EX2: When control flow is intended to cross statement labels, it is permissible to omit the break statement. In these instances, the unusual control flow must be explicitly documentedmade clear, such as by adding the [[fallthrough]] C2x attribute, the __attribute__((__fallthrough__)) GNU extension, or a simple comment.

Code Block
bgColor#CCCCFF
langc
enum WidgetEnum { WE_W, WE_X, WE_Y, WE_Z } widget_type;
widget_type = WE_X;

switch (widget_type) {
  case WE_W:
    /* ... */
    /* No break; fall processthrough caseto forthe WE_X as wellcase */
  case WE_X:
    /* ... */
    break;
  case WE_Y: case WE_Z:
    /* ... */
    break;
  default: /* Can't happen */
	 /* Handle error condition */
}

...