On 01/04/2013 04:13 AM, bearophile wrote:
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

The first version is fine. The range computed for 'y' is [0..256[ in both cases.

Reply via email to