On Sunday, 10 November 2013 at 12:19:18 UTC, mike james wrote:
When writing software for embedded micros you can always check an overflow flag - is the no such mechanism on PC software?


This is not overflow checking, it's the compiler considering a
variable of type int implicitely convertible to equivalent
unsigned types at bit level.

I suppose it's a bug or may be the documentation is wrong
(http://dlang.org/type.html):

ubyte  u1 = cast(byte)-1;  // error, -1 cannot be represented in
a ubyte
ushort u2 = cast(short)-1; // error, -1 cannot be represented in
a ushort

These two lines are succesfully compiled by the last DMD on Windows.

Reply via email to