Reputation: 17467
I am a newbie of programming D
. After reading Fundamental Types, I decide to check the size_t
type in my 64
-bit Windows 7 OS. The code is like this:
import std.stdio;
void main()
{
writeln("Type: ", size_t.stringof);
writeln("Size: ", size_t.sizeof);
}
After executing, the output is:
Type: uint
Size: 4
Per my understanding, the type of size_t
should be ulong on 64
-bit OS.
Could anyone give any clue? Thanks very much in advance!
Upvotes: 5
Views: 664
Reputation: 25187
The bitness of your program is distinct from the bitness of the OS or the compiler.
With DMD, to create a 64-bit executable, specify the -m64
switch. By default, DMD will create programs with the same bitness as the compiler, and the Windows package includes a 32-bit compiler. (If you wish, you can also build a 64-bit compiler from source code, but this will not affect how it builds either 32-bit or 64-bit programs.)
Upvotes: 9