C++里面的类型 __w64 是什么意思
#define_W64__w64typedefunsigned__int64uintptr_t;__w64和__int64代表了什么类型的数据呢?...
#define _W64 __w64
typedef unsigned __int64 uintptr_t;
__w64 和 __int64 代表了什么类型的数据呢? 展开
typedef unsigned __int64 uintptr_t;
__w64 和 __int64 代表了什么类型的数据呢? 展开
展开全部
__w64是一个关键字, 编译器相关的关键字.
意思是说这个类型使用64位兼容方式编译, 在编译64位程序时指针就被视为64位宽, 而不是32位.
int也有可能会被视为64位.
__int64 应该就是
typedef int __w64 __int64 这样吧.
意思是说这个类型使用64位兼容方式编译, 在编译64位程序时指针就被视为64位宽, 而不是32位.
int也有可能会被视为64位.
__int64 应该就是
typedef int __w64 __int64 这样吧.
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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;
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;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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.
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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2016-01-08 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
在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
#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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询