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

d coder dlang.coder at gmail.com
Tue Dec 11 04:23:15 PST 2012


Greetings

The following code prints FFFF0000. Similar thing happens when a and b are
bytes.
Is this intended?

Regards
- Puneet

void main()
{
  import std.stdio;
  ushort a = 0x55AA;
  ushort b = 0xAA55;
  writefln("%X", ~(a | b));
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121211/9ea06c6c/attachment.html>


More information about the Digitalmars-d mailing list