1 out of 1 rated this helpful - Rate this topic

/Wp64 (Detect 64-Bit Portability Issues)

Detects 64-bit portability problems on types that are also marked with the __w64 keyword.

/Wp64

By default, the /Wp64 compiler option is off in the Visual C++ 32-bit compiler and on in the Visual C++ 64-bit compiler.

Important note Important

The /Wp64 compiler option and __w64 keyword are deprecated in Visual Studio 2010. If you convert a project that uses this switch, the switch will not be migrated during conversion. To use this option in Visual Studio 2010, you must type the compiler switch under Additional Options in the Command Line section of the project properties. If you use the /Wp64 compiler option on the command line, the compiler issues Command-Line Warning D9035. Instead of using this option and keyword to detect 64-bit portability issues, use a Visual C++ compiler that targets a 64-bit platform. For more information, see 64-Bit Programming with Visual C++.

Variables of the following types are tested on a 32-bit operating system as if they were being used on a 64-bit operating system:

  • int

  • long

  • pointer

If you regularly compile your application by using a 64-bit compiler, you can just disable /Wp64 in your 32-bit compilations because the 64-bit compiler will detect all issues. For more information about how to target a Windows 64-bit operating system, see 64-Bit Programming with Visual C++.

To set this compiler option in the Visual Studio development environment

  1. Open the project Property Pages dialog box.

    For more information, see How to: Open Project Property Pages.

  2. Click the C/C++ folder.

  3. Click the Command Line property page.

  4. Modify the Additional Options box to include /Wp64.

To set this compiler option programmatically

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Missing warnings while compiling with VS 2010 for 64 bit
I reported this at Microsoft Connect as a bug (ID 635209) and Microsoft confirmed that this is an issue. May be fixed with a later release. Until than, you may continue using the /Wp64 switch.
VS 2010 Compiler not detecting 64-bit Issues
I'm using VS2010 and created a console C++ app. When I compile for 64-bit, I get no warnings at all, but adding the /Wp64 switch, I do get the following warnings:

64-tests.cpp(15): warning C4311: 'type cast' : pointer truncation from 'int *' to 'int'
64-tests.cpp(15): warning C4312: 'type cast' : conversion from 'int' to 'int *' of greater size

Why doesn't the 64-bit compiler detect these issues w/o the flag? (which has been deprecated)

[tfl - 02 09 10] Hi - and thanks for your post.You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn. You are much more likely get a quick response using the forums than through the Community Content. 
For specific help about:
.Net Development : http://social.msdn.microsoft.com/Forums/en-US/category/visualstudio
Open Specifications : http://social.msdn.microsoft.com/Forums/en-US/category/openspecifications
SharePoint 2010 : http://social.msdn.microsoft.com/Forums/en-US/category/sharepoint2010
SQL : http://social.msdn.microsoft.com/Forums/en-US/category/sqlserver
Visual Studio : http://social.msdn.microsoft.com/Forums/en-US/category/visualstudio
Advertisement