Simple .d file passed in -m32 model, but failed in -m64 model. Why?
David Wang
osx.david at live.com
Sun Feb 20 06:25:32 PST 2011
Thank you Brad Roberts, at first I remove MinGW's PATHs in my system, and then
I successfully compiled the DMD, then I added back the MinGW's PATHs to the
system. :-)
But, when I in Linux (Fedora 14 X86_64) system, I compiled a simple d file in
32bit model and 64 bit model I got different results.
Details:
1). test.d source:
=================
import std.stdio;
void main()
{
writeln("Under 32bit model & 64bit model: \n");
int[] months = new int[12];
months = [99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99];
writeln("Original months array value: \n", months,
"\n\n=====================");
writeln("start to bind in turn:");
foreach (i, ref e; months)
{
writeln("index i = ", i, ", \"looked \'in\' array\" value e = ", e);
e = i + 1;
writeln("temp i = ", i, ", temp e = i + 1 = ", e);
writeln("months array: ", months);
writeln("used i = ", i, ", and used e = ", e, "\n");
}
writeln("finished binding...");
writeln("=====================\n\nFinal months array value: \n", months);
}
=================
2). I compile it using the command:
[David at Ocean ~]$ dmd -m32 test.d
And I successfully got the result "test" file.
3). I compile it using the command:
[David at Ocean ~]$ dmd -m64 test.d
And I got the error:
"test.d(18): Error: cannot implicitly convert expression (i + 1LU) of type
ulong to int"
Why the same source file shows different results?
How to fix this problem?
Waiting for kindly help.
Daivd.
More information about the Digitalmars-d
mailing list