Is there any reason why arithmetic operation on shorts and bytes return int?

bearophile bearophileHUGS at lycos.com
Tue Dec 11 09:00:46 PST 2012


d coder:

> Why is the following allowed in D?
>
> long a;
> int b;
>
> b += a; // Allowed -- no explicit cast
> b = a + b; // Not allowed
> b = a;      // Not allowed

Seems a bug of range analysis.

Bye,
bearophile


More information about the Digitalmars-d mailing list