Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] [Patch] iostat win32 build

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Mon, 2 Dec 2002 14:44:57 -0800
On Mon, Dec 02, 2002 at 02:20:33PM -0600, Esh, Andrew wrote:
> BTW: In the syntax below, it is also legal to have multiple cases stacked
> above a single statement, so "case {constant-expression} :" is legal, if it
> is followed by another case. I'm not sure if that's standard C,

The syntax in question was copied directly from the ANSI C standard, and
a {statement} is (from 3.6 "Statements"):

	{statement}:
	     {labeled-statement}
	     {compound-statement}
	     {expression-statement}
	     {selection-statement}
	     {iteration-statement}
	     {jump-statement}

so you can stack labels (whether they're case labels, "default" labels,
or goto labels), as long as there's a statement after the last of the
labels, as a {labeled-statement} is a {statement} and thus you can have,
as a {labeled-statement}:

	case {constant-expression} : {labeled-statement}

and thus

	case {constant-expression} : case {constant-expression}: {labeled-statement}

and so on.