digitalmars.D.learn - Arithmetic conversion -- warnings missing?
- Q. Schroll (21/21) Sep 03 2015 import std.stdio;
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?
Sep 03 2015