Bug in shifting

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Dec 14 02:17:20 UTC 2018


On Thursday, December 13, 2018 6:56:33 PM MST Steven Schveighoffer via 
Digitalmars-d-learn wrote:
> On 12/13/18 7:16 PM, Michelle Long wrote:
> > I've noticed the compiler is not throwing up errors and warnings like it
> > used to:
> >
> > I thought D required breaks for cases? Seems it doesn't any longer! I'm
> > only using -g -gf -d
>
> It doesn't require breaks for cases, it requires no fall-through on
> cases. Again, an example would help describe what you mean.

Well, to be more precise, it doesn't allow fallthrough when the case
statement contains code. It will allow it when it doesn't. e.g.

case 0:
case 1: break;

is perfectly legal. However, when the case statement contains code, then
yeah, some form of control statement is required to exit the case statement,
but that's a lot more than just break. continue, goto, return, etc. can all
be used to exit a case statement. Any control statement that explicitly
exits the case statement will work. And of course, goto case can be used for
explicit fallthrough.

- Jonathan M Davis





More information about the Digitalmars-d-learn mailing list