The difference between DWORD and int in C++

INT represents int, and
DWORD represents unsigned long
int, which will change with the number of machine bits. For example, it is 16 bits on a 16-bit machine, 32 bits on a 32-bit machine, and 64 bits on a 64-bit machine. Just look at the original definition.

DWORD is unsigned, equivalent to unsigned long, which is the data type of MFC.
Int is symbolic, and the number of bytes it occupies is not necessarily 4. It mainly
depends on your IDE. For example, in Turbo C, it is 2 bytes, and in VC6.0, it is 4 bytes.

Don't treat int as 32 bits

It was already mentioned in the book

long 32-bit signed integer
int 32-bit signed integer
DWORD 32-bit unsigned integer

typedef unsigned long DWORD;

DWORD is generally used when the return value will not contain negative numbers.

Whether to use int or DWORD depends on the specific situation.

Guess you like

Origin blog.csdn.net/gogocsdn1/article/details/110959858