For some more clarity, when I compile the following code:

void main() {
  import std.stdio;
  byte a;
  byte b;
  byte c = a + b;
}

I get error:
test.d(6): Error: cannot implicitly convert expression (cast(int)a +
cast(int)b) of type int to byte

Why is D trying to convert bytes and shorts to integers before applying any
arithmetic operator?

Regards
- Puneet

Reply via email to