Chinaunix首页 | 论坛 | 博客
  • 博客访问: 208715
  • 博文数量: 64
  • 博客积分: 2010
  • 博客等级: 上尉
  • 技术积分: 720
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-25 19:03
文章分类

全部博文(64)

文章存档

2013年(1)

2012年(9)

2011年(25)

2010年(7)

2009年(16)

2008年(6)

分类: WINDOWS

2011-11-30 11:11:02

(以字节表示)
          win32        win64
------------------------------------
<最基本的类型>
char        1            1
short       2            2
int         4            4
long        4            4
double      8            8
---------------------------------------------------
1.关于size_t,在sdk中的stdio.h文件中,如下定义

#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64  size_t;
#else
typedef _W64 unsigned int  size_t;
#endif
#define _SIZE_T_DEFINED
#endif
也就是说,size_t在64位中为64位,在32位中为32位。
2.在windef.h 有如下定义:
#ifndef BASETYPES
#define BASETYPES
typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef unsigned char UCHAR;
typedef ULONG *PULONG;
typedef USHORT *PUSHORT;
typedef UCHAR *PUCHAR;
typedef char  *PSZ;
#endif

typedef unsigned long    DWORD;
typedef int              BOOL;
typedef unsigned char    BYTE;
typedef unsigned short   WORD;
typedef float            FLOAT;
typedef FLOAT            *PFLOAT;
typedef BOOL near        *PBOOL;
typedef BOOL far         *LPBOOL;
typedef BYTE near        *PBYTE;
tyepdef BYTE far         *LPBYTE;
typedef int  near        *PINT;
typedef int  far         *LPINT;
typedef WORD near        *PWORD;
typedef WORD far         *LPWORD;
typedef long far         *LPLONG;
typedef DWORD near       *PDWORD;
typedef DWORD far        *LPDWORD;
typedef void far         *LPVOID;
typedef CONST void far   *LPCVOID;

typedef int              INT;
typedef unsigned int     UINT;
typedef unsigned int     *PUINT;

typedef UINT             WPARAM;
typedef LONG             LPARAM;
typedef LONG             LRESULT;

3.在basetsd.h中有如下的定义:

typedef int LONG32,*PLONG32;
typedef int INT32, *PINT32;

typedef unsigned int ULONG32,*PULONG32;
typedef unsigned int DWORD32,*PDWORD32;
typedef unsigned int UINT32,*PUINT32;

#ifdef _WIN64
typedef __int64  INT_PTR,*PINT_PTR;
typedef unsigned __int64 UINT_PTR,*PUINT_PTR;

typedef unsigned int UHALF_PTR ,*PUHALF_PTR;
typedef int   HALF_PTR, *PHALF_PTR;

#else
typedef long INT_PTR, *PINT_PTR;
typedef unsigned long UINT_PTR, *PUINT_PTR;

typedef unsigned short UHALF_PTR ,*PUHALF_PTR;
typedef short   HALF_PTR, *PHALF_PTR;
#endif

typedef UINT_PTR SIZE_T, *PSIZE_T;
typedef INT_PTR  SSIZE_T, *PSSIZE_T;

typedef __int64 LONG64,*PLONG64;
typedef __int64 INT64, *PINT64;

typedef unsigned __int64 ULONG64,*PULONG64;
typedef unsigned __int64 UINT64, *PUINT64;
typedef unsigned __int64 DWORD64, *PDWORD64;


从这些定义中我们可以知道这些数据类型在win32 和 win 64 下的大小。
----------------------------------------------------

<值得注意的是在win64下,所有的指针类型数据都变成长度为8字节)

DWORD       4            4   (typedef unsigned long DWORD)
LPDWORD     4            8   (typedef DWORD far *LPDWORD)

阅读(1775) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~