On 08/20/2016 11:25 AM, Shachar Shemesh wrote:
On 20/08/16 00:51, Walter Bright wrote:
On 8/18/2016 7:59 PM, Adam D. Ruppe wrote:
Alas, C insisted on making everything int all the time and D followed
that :(


Actually, Adam's suggestion on how things should work is precisely how C
works (except it trails off at int).

a = b + c;

if b and c are both a byte, and a is a byte, the result is unpromoted.
If a is a short, the result is promoted. I know the mechanism is
completely different than what Adam was suggesting, but the end result
is precisely the same.

Consider:

void fun(byte);
void fun(int);
fun(b + c);

Under the new rule, this code (and much more) would silently change behavior. How would that get fixed?

One would have to be *really* sure of their ground in coming up with
allegedly better rules.


Would "no narrowing implicit casts" be considered such a better rule? :-)

Again, I'm not saying it's a bad rule, just that does have consequences.
What I'm saying is that we are, already, changing things.

Again: choose your fights/points and fight/make them well. This is not one worth having.


Andrei

Reply via email to