Preventing implicit conversion
ixid via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 4 06:35:07 PST 2015
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
> Is there an elegant way of avoiding implicit conversion to int
> when you're using shorter types?
Also does this not seem inconsistent:
ushort a = ushort.max, b = ushort.max;
a += b; // Compiles fine
a = a + b; // Error: cannot implicitly convert expression
(cast(int)a + cast(int)b) of type int to ushort
More information about the Digitalmars-d-learn
mailing list