__w64
(Microsoft 专用)此关键字已过时。 在早于 Visual Studio 2013 的 Visual Studio 版本中,允许标记变量,以确保在使用 /Wp64 进行编译时,编译器将报告使用 64 位编译器编译时报告的任何警告。
type __w64 identifier
参数
type
导致代码问题的以下三种类型之一将从 32 位编译器移植到 64 位编译器:intlong 或指针。identifier
要创建变量的标识符。
备注
重要
/Wp64 编译器选项和 __w64 关键字在 Visual Studio 2010 和 Visual Studio 2013 中已弃用,并从 Visual Studio 2013 开始删除。如果在命令行中使用 /Wp64 编译器选项,编译器将发出 Command-Line Warning D9002。__w64 关键字在无提示的情况下忽略。请勿使用此选项和关键字来检测 64 位可移植性问题,请使用面向 64 位平台的 Visual C++ 编译器。有关更多信息,请参见64 位配置的程序 (Visual C++)。
具有 __w64 的任何 typedef 必须是 32 位(在 x86 上)和 64 位(在 x64 上)。
若要通过使用早于 Visual Studio 2010 的 Visual C++ 编译器版本来检测可移植性问题,应在其在 32 位平台与 64 位平台之间变换大小的任何 typedef 上指定 __w64 关键字。 对于任何此类类型,__w64 必须仅在 typedef 的 32 位定义上出现。
如果编译不使用 /Wp64,则将忽略 __w64 关键字。
有关移植到 64 位编译器的详细信息,请参阅以下主题:
示例
// __w64.cpp
// compile with: /W3 /Wp64
typedef int Int_32;
#ifdef _WIN64
typedef __int64 Int_Native;
#else
typedef int __w64 Int_Native;
#endif
int main() {
Int_32 i0 = 5;
Int_Native i1 = 10;
i0 = i1; // C4244 64-bit int assigned to 32-bit int
// char __w64 c; error, cannot use __w64 on char
}