One of the things we want to do with the Treatyist is bring in more powerful modelling to convey some of our ideas about the economic and scientific issues of the day. To get the performance we want, this means native code, C++, with some assembly, where interesting. With 64 bit hardware now current, and with many shipping Windows installations 64 bit by default, we feel that, its time to explore 64 bits. For us, 64 bit really means, AMD64, otherwise known as x86-64 or just x64.
To program in 64 bit native code, we use Visual Studio 2008 professional. Getting a 64 bit program to be produced by C++ is not automatic, and there are some steps to do.
Select create a new Win32 project from the menu.
This will give you a 32 bit console project. To change it to an x64 project, you need to create a new processor target and in Visual Studio talk, that's a new Solution Platform. You can do this from the Configuration Manager. Remember to do both the debug and release targets.
Our first Windows 7 64 bit project is simple. Print sizes of C++ types source code. We just print out the size, in bytes, of the various fundamental data types in C++. Notice, from the output, that while a pointer is 8 bytes, as we would expect, surprisingly, the long is 4 bytes. This is different from Unix, which uses a 4 byte long. You are warned!
If this did not confirm, for you, that your application is running in 64 bit native land, then, looking at the disassembly view from the debugger surely will. You can click on the following picture to zoom in on it.
Notice the registers rax, rsp, etc. That's your 64 bit smoking gun. x64 has not only differently named registers, but also more of them. This is a great thing! A lack of registers has been a huge criticism of 32 bit Intel and earlier architectures. But, in 64 bit world, you are not in limited register land, any more!