Bug in shifting

Michelle Long HappyDance321 at gmail.com
Fri Dec 14 03:22:19 UTC 2018


On Friday, 14 December 2018 at 02:17:20 UTC, Jonathan M Davis 
wrote:
> 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

I thought I had code in it which is what struct me as odd. There 
is a good chance I was wrong about this though since I was adding 
a bunch of case statements and code. Given that this occurred 
with the other problem might correlate to something else. Not 
that big a yet but the first struck me as a big problem if it is 
a bug... having code that should error but passes and provides 
wrong calculations is very prone to producing major bugs in a 
program.

I don't feel like trying to reproduce them, but if they crop up 
again I'll try and catch them.




More information about the Digitalmars-d-learn mailing list