C++里面的类型 __w64 是什么意思

#define _W64 __w64
typedef unsigned __int64 uintptr_t;

__w64 和 __int64 代表了什么类型的数据呢?

__int64 是64位整型数 变量类型,相当于: long long int

unsigned __int64 是64位 无符号整型数 变量类型,相当于: unsigned long long int

__w64 是64位WORD, 对应于 16 位的 WORD, 32 位的 DWORD.

#define _W64 __w64 这样,__W64 大写和__w64 小写 一样
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2018-03-06
__w64是一个关键字, 编译器相关的关键字.

意思是说这个类型使用64位兼容方式编译, 在编译64位程序时指针就被视为64位宽, 而不是32位.
int也有可能会被视为64位.

__int64 应该就是
typedef int __w64 __int64 这样吧.本回答被网友采纳
第2个回答  2015-10-29
1、在64为编译器下,而且打开了/Wp64编译选项时,编译器会对使用了__w64的类型进行32位到64位移植性的判断,比如将64位指针赋给INT_PTR时,编译器就会发出警告。INT_PTR int(_W64 int即__w64 int) * _W64 int→INT_PTR,_W64就是__w64,是为了解决32位与64位编译器的兼容性而设置的关键字 用于指针运算

2、宏定义:
#if defined(_WIN64)
typedef __int64 INT_PTR, *PINT_PTR;
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
typedef __int64 LONG_PTR, *PLONG_PTR;
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
#define __int3264 __int64#elsetypedef _W64 int INT_PTR, *PINT_PTR;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
typedef _W64 long LONG_PTR, *PLONG_PTR;
第3个回答  2012-07-23
Microsoft C/C++ features support for sized integer types. You can declare 8-, 16-, 32-, or 64-bit integer variables by using the __intn type specifier, where n is 8, 16, 32, or 64.
The following example declares one variable for each of these types of sized integers:
__int8 nSmall; // Declares 8-bit integer
__int16 nMedium; // Declares 16-bit integer
__int32 nLarge; // Declares 32-bit integer
__int64 nHuge; // Declares 64-bit integer
---------------------------------------------------------------
The __w64 keyword lets you mark variables, such that when you compile with /Wp64 the compiler will report any warnings that would be reported if you were compiling with a 64-bit compiler.
Any typedef that has __w64 on it must be 32 bits on x86 and 64 bits on ia64.
The __w64 modifier should be specified on any typedefs that change size between 32 bit and 64 bit platforms. For any such type, __w64 should appear only on the 32-bit definition of the typedef. For example:
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
__w64 is ignored if the compilation does not use /Wp64.

参考资料:MSDN Library

第4个回答  2016-01-08
在64为编译器下,而且打开了/Wp64编译选项时,编译器会对使用了__w64的类型进行32位到64位移植性的判断,比如将64位指针赋给INT_PTR时,编译器就会发出警告。INT_PTR int(_W64 int即__w64 int) * _W64 int→INT_PTR,_W64就是__w64,是为了解决32位与64位编译器的兼容性而设置的关键字 用于指针运算 看这段宏:
#if defined(_WIN64)
typedef __int64 INT_PTR, *PINT_PTR;
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;

typedef __int64 LONG_PTR, *PLONG_PTR;
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;

#define __int3264 __int64

#else
typedef _W64 int INT_PTR, *PINT_PTR;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;

typedef _W64 long LONG_PTR, *PLONG_PTR;
typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR;

#define __int3264 __int32
相似回答