/Wp64

/Wp64 (Detect 64-Bit Portability Issues) is the key of Visual C++ compiler. The key appeared in Visual Studio 2003 and was intended for preparing migration of applications on 64-bit systems. In Visual Studio 2008 /Wp64 key is considered obsolete for it is high time we began to compile 64-bit applications and not to prepare for them.

When defining /Wp64 key the compiler detects some potential errors which can occur when compiling C/C++ code for 64-bit systems. Test of the code consists in that the types marked by the key word __w64 in 32-bit code are interpreted as 64-bit types during the test.

"value32 = size;" expression on a 64-bit system will cause value cutoff and, consequently, to a potential error. We want to diagnose it. But when compiling a 32-bit application everything is correct and we won't get a warning message.

To prepare for 64-bit systems we should add /Wp64 key and insert the key word __w64 when defining MySSizet type in a 32-bit version. As the result we have the following code:

Now we'll get the warning message C4244 which will help us to prepare for porting the code on a 64-bit platform.

You should understand that /Wp64's abilities are rather limited. A more detailed and specialized code test can be performed by the commercial tool Viva64 developed specially for simplifying port of applications on 64-bit systems.

We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button.
Learn More →