Please tell me this is a bug?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 22 11:09:58 PST 2015


On Sunday, 22 February 2015 at 14:18:24 UTC, Peter Alexander 
wrote:
> If VRP is unknown then it should be disallowed for precisely 
> that reason! It can't implicitly cast back to a byte, so it 
> shouldn't. If you know that the int fits in a byte then do the 
> cast yourself, that's what it's for.

Question though, how do you physically write the cast for:

byte a;
a += 1;

With a + 1, you can cast that whole right hand side. But with 
+=1, there's nowhere to put the cast! If you cast(byte) 1, it 
changes nothing, since it could still overflow.


More information about the Digitalmars-d mailing list