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:
        if( _keyHandler ) {
            _keyHandler( cast( Key )event.key.keysym.scancode,
                         cast( KeyState )event.key.state,
                         cast( KeyModifier )event.key.keysym.mod );
        }
        break;

    case SDL_WINDOWEVENT:
        handleWindowEvent( &event.window );
        break;

    case SDL_QUIT:
        if( _quitHandler ) {
            _quitHandler();
        }
        break;

    default: break;
}

Reply via email to