Arithmetic conversion -- warnings missing?
Q. Schroll via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 3 18:20:38 PDT 2015
import std.stdio;
void main()
{
short ss = -1;
ushort us = 0;
int si = -1;
uint ui = 0;
if (ss < us)
writeln("a");
else
writeln("b");
if (si < ui)
writeln("A");
else
writeln("B");
}
prints "aB" due to integral promotion and arithmetic conversion
rules. I know it's this kind of thing: If it compiles and looks
like c, it behaves the same.
But why does it compile and why does it so without any warning?
Is there any rationale to make this even work?
More information about the Digitalmars-d-learn
mailing list