More value range analysis?

bearophile bearophileHUGS at lycos.com
Thu Jan 3 19:13:10 PST 2013


> void main(string[] args) {
>     ubyte x = cast(ubyte)args.length;
>     immutable int y = x;
>     // Here y must be in [0, 256[.
> }

Sorry, that example was meant to be:


void main(string[] args) {
     immutable ubyte x = cast(ubyte)args.length;
     immutable int y = x;
     // Here y must be in [0, 256[.
     ubyte z = y;
}


Bye,
bearophile


More information about the Digitalmars-d mailing list