• Advertisement


This topic is now archived and is closed to further replies.

is WORD just typedef unsigned int WORD?

This topic is 5846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am still very new to programming in C++. Recently I have started learning to create a windows. All my experience up to now has been basic programming in a DOS box. To declare a positive integer variable I would always use "unsigned int" now that I have started messing around with windows and including almost every resource I read for help now uses "WORD" to declare an unsigned integer. Is WORD just "typedef unsigned int WORD;"? If not what is the difference please? Thanks to who ever throws me some input on this in advanced. ThermoFish

Share this post

Link to post
Share on other sites
I think that a WORD is an unsigned 16-bit int, but I don''t know exactly how it is defined. (In MSVC, it could be defined as typedef unsigned __int16 WORD).


I finally got it all together...
...and then forgot where I put it.

Share this post

Link to post
Share on other sites
A word in generic non-platform-specific terms is considered 2 bytes. A double word is 2 words etc...

From a windows point of view, WORD is a typedef for an unsigned 16 bit integer. Here are most of the common windows types (defined in windef.h)

typedef unsigned long ULONG;
typedef ULONG *PULONG;
typedef unsigned short USHORT;
typedef unsigned char UCHAR;
typedef UCHAR *PUCHAR;
typedef char *PSZ;
#endif /* !BASETYPES */

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;
typedef 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 void *HANDLE;
typedef int INT;
typedef unsigned int UINT;
typedef unsigned int *PUINT;

Share this post

Link to post
Share on other sites
AHH!! Thanks a lot. I was looking in for all those typedefs. Thanks for posting they are in .

One more question now. Is it possible to make typedefs color coded like standard keywords under VC++? I like being able to see my variables a little clearer and by using the typedefs in the the types are just plain black.

Share this post

Link to post
Share on other sites

  • Advertisement