Annoyance with new integer promotion deprecations

Adam D. Ruppe destructionator at gmail.com
Mon Feb 5 21:42:09 UTC 2018


On Monday, 5 February 2018 at 21:25:41 UTC, Walter Bright wrote:
> The real bug is that VRP should allow this particular case.

No, because of the byte.min case after promotion to int actually 
loses information.

But the promotion to int suuuuuuucks. I gave this a lot of 
thought a few months ago... but wrote it in irc and forgot to 
copy lol.

The jist of it was to make int math work kinda like float math. 
Where everything is promoted to the largest type in the 
expression and if truncation happens, so be it.

int a = 1;
int b = 2;
float f = 1/2; // f == 0, we know this and are ok with it

byte a = 127;
byte b = 1;
byte c = a + b; // this should just wrap and assign!


Of course it is slightly different than C. C, the ruiner of all 
good things.


More information about the Digitalmars-d mailing list