Windows' 64-bit API will allow the most demanding enterprise, scientific, and engineering applications to run on Windows platforms using the next generation of 64-bit processors. A few simple precautions will help assure that your programs can be targeted at both Win32 and Win64 platforms.
Additional Reading
The best additional information sources are the MSDN library and information posted by Microsoft. Here are some suggestions from Microsoft and elsewhere.
The Microsoft "New Data Types" article is available at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/the_new_data_types.asp. Tables 16-1 and 16-2 are from this article.
"Introduction to Developing Applications for the 64-bit Version of Windows" is a good short introduction that describes the different programming models. The paper is available at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetserv/html/ws03-64-bitwindevover.asp. This paper also has a brief Itanium overview, even though Itanium is not the only Win64 host processor.
The UNIX "Aspen" rationale, which makes a strong case for the LP64 model, is available at http://www.opengroup.org/public/tech/aspen/lp64_wp.htm.
An article, "Migration Tips," at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/migration_tips.asp provides good 32-bit to 64-bit porting tips and has additional useful links. A Web search will locate additional advice and information.
If you are interested in computer architecture in general, Computer Architecture: A Quantitative Approach, by John L. Hennessy and David A. Patterson, is the standard. For specific Itanium information, see Walter Triebel's Itanium Architecture for Software Developers. The Intel and AMD Web sites (http://www.intel.com and http://www.amd.com/us-en) have extensive architectural information on the 64-bit extension architectures.
Exercises
161.
Assume that p1 and p2 are pointers with p1 > p2, and you wish to subtract them in order to obtain the distance between two items. Under what conditions would the expression (DWORD)p1 - (DWORD)p2 be valid? Assuming that the distance is not large, is it necessary to change this expression to (DWORD)(p1 - p2)? Hint: Consider the properties of two's complement arithmetic.
162.
Remove all 64-bit compiler warnings, if any, from other pointer-intensive programs such as sortBT (Program 5-1) and ThreeStage (Program 10-5).
163.
If you have access to a Win64 system, test the 64-bit programs. Also, assure that the 32-bit builds still operate correctly.
Appendix A. Using the Sample Programs
The book's support Web site (http://www.awprofessional.com/0321227255) contains a zip file with the source code for all the sample programs as well as the include files, utility functions, projects, and executables. A number of programs illustrate additional features and solve specific exercises, although the Web site does not include solutions for all exercises or show every alternative implementation.
All programs have been tested while running under Windows 2000, XP, and 2003 on a wide variety of systems, ranging from laptops to servers. Where appropriate, they have also been tested under Windows 9x, although many programs, especially those from later chapters, will not run on Windows 9x or even on NT 4.0.
The programs have been built and run with and without UNICODE defined. Under Windows 9x, only the non-Unicode versions will operate.
Nearly all programs compile without warning messages under Microsoft Visual C++ Versions 7.0 and 6.0 using warning level 3. There are a few minor exceptions, such as warnings about "no return from main program" when ExitProcess is used.
Distinct project directories are provided for Microsoft Visual Studio .NET and Visual Studio C++ 6.0. The two directories are ProjectsV7 and ProjectsV6. The projects build the executable programs in the run7 and run6 directories, respectively.
The generic C library functions are used extensively, as are compiler-specific keywords such as __try, __except, and __leave. The multithreaded C run-time library, _beginthreadex, and _endthreadex are essential starting with Chapter 7.
The projects (in release, not debug, form) and make files are included. The projects are all very simple, with minimal dependencies, and can also be created quickly with the desired configuration and as either debug or release versions.
The projects are defined to build all programs, with the exception of static or dynamic libraries, as console applications.
It is also possible to build the programs using open source development tools, such as gcc and g++ in the Gnu Compiler Collection (http://gcc.gnu.org/). Readers interested in these tools should look at the MinGW open source project (http://www.mingw.org), which describes MinGW as "a collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU toolsets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs." I have not tested most of the programs using these tools, however, but I have had considerable success using MinGW and have even been able to cross-build, constructing Windows executable programs and DLLs on a Linux system. Furthermore, I've found that gcc and g++ provide very useful 64-bit warning and error messages.