Switch-case made less buggy, now with PATCH!

Leandro Lucarella llucax at gmail.com
Fri Nov 20 21:37:14 PST 2009


Tim Matthews, el 21 de noviembre a las 18:10 me escribiste:
> Chad J wrote:
> >http://d.puremagic.com/issues/show_bug.cgi?id=3536
> >
> >So Walter, with this you can keep your beloved fall-through.
> >Now can the rest of us be spared the nasty fall-through bugs, please
> >please please??
> >
> >Also, about assert(0)... I'd be happy to change what I did if Walter and
> >associates feel that adding assert(0) to the list is worth its minor
> >complications.
> >
> >(Sorry I don't have a patch for properties, but that one's harder.)
> >
> >- Chad
> 
> I like having both fall through and breaking out explicit but was
> the final syntax ever discussed here first?
> 
> Other possible options include 'fallthrough;' or just have the usual
> goto case for falling through too and let the compiler's
> optimization routines remove the unnecessary jumps when it sees the
> goto case as the next in sequence.

There is already goto case; (without specifying the case) for that, at
least in the specs :)

http://www.digitalmars.com/d/2.0/statement.html#GotoStatement

GotoStatement:
   goto Identifier ;
   goto default ;
   goto case ;
   goto case Expression ;

[...]

The third form, goto case;, transfers to the next CaseStatement of the
innermost enclosing SwitchStatement.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Every year is getting shorter never seem to find the time.
Plans that either come to nought or half a page of scribbled lines.
Hanging on in quiet desparation is the English way.
The time is gone, the song is over, thought I'd something more to say.



More information about the Digitalmars-d mailing list