Bug in shifting

Neia Neutuladh neia at ikeran.org
Fri Dec 14 06:25:16 UTC 2018


On Fri, 14 Dec 2018 00:16:51 +0000, Michelle Long wrote:
> byte x = 0xF;
> ulong y = x >> 60;

"Error: shift by 60 is outside the range 0..31"

This is the result of integer promotion rules. Change the 30 to a 60 and 
it works, and the result is, as you would expect, 0.

> I thought D required breaks for cases? Seems it doesn't any longer!

A number of things can terminate a case block:
* break
* continue
* goto
* assert
* throw
* return

Probably a few others.


More information about the Digitalmars-d-learn mailing list