On Sun, 16 Feb 2014 11:37:48 -0500, Mike Parker <[email protected]> wrote:

On 2/17/2014 12:42 AM, Manu wrote:
So D offers great improvements to switch(), but there are a few small
things I wonder about.

1.
case fall-through is not supported; explicit 'goto case n;' is required.

I only get the error when falling through to default, in which case it says:

  Error: switch case fallthrough - use 'goto default;' if intended

Fall-through compiles and runs otherwise. This is something I'm doing right now:

switch( event.type ) {
     // No error on falling through here <<<---------------------.
     case SDL_KEYDOWN:
     case SDL_KEYUP:

This is allowed, because there is no code between the case statements. It's the one case where fallthrough is allowed. If you put a statement in between the two, it would complain.

-Steve

Reply via email to