Casting from int to long

Yui Hosaka hos at hos.ac
Mon Nov 25 18:52:29 UTC 2019


On Monday, 18 November 2019 at 15:16:11 UTC, Yui Hosaka wrote:
> I have encountered some kind of "32-bit / 64-bit issues" 
> several times (https://issues.dlang.org/show_bug.cgi?id=20162, 
> https://issues.dlang.org/show_bug.cgi?id=20128).

Not sure it is related, but DMD32 with -O has the following 
seemingly bug...

----
import std.stdio;
void main() {
   foreach (a; 0L .. 4L) foreach (b; 0L .. 4L) {
     pragma(msg, typeof(a));
     pragma(msg, typeof(b));
     writeln(a, " ", b);
   }
}
----

Compiler Output:
----
long
long
----

Output:
----
0 0
0 4294967297
0 2
0 4294967299
1 0
1 4294967297
1 2
1 4294967299
2 0
2 4294967297
2 2
2 4294967299
3 0
3 4294967297
3 2
3 4294967299
----


More information about the Digitalmars-d-learn mailing list