Export (0) Print
Expand All

Porting 32-Bit Code to 64-Bit Code

This topic discusses coding issues for developing applications to run on Windows 64-bit operating systems.

When you use Visual C++ to create applications to run on a 64-bit Windows operating system, you should be aware of the following issues:

  • An int and a long are 32-bit values on 64-bit Windows operating systems.
  • size_t, time_t, and ptrdiff_t are 64-bit values on 64-bit Windows operating systems.
  • time_t is a 32-bit value on 32-bit Windows operating systems.

    You should be aware of where your code takes an int value and processes it as a size_t or time_t value. It is possible that the number could grow to be larger than a 32-bit number and data will be truncated when it is passed back to the int storage.

The %x (hex int format) printf modifier will not work as expected on a 64-bit Windows operating system; it will only operate on the first 32 bits of the value that is passed to it.

  • Use %I32x to display an integer on a Windows 32-bit operating system.
  • Use %I64x to display an integer on a Windows 64-bit operating system.
  • The %p (hex format for a pointer) will work as expected on a 64-bit Windows operating system.

See Also

Porting Your Program

Show:
© 2014 Microsoft