Differences between word, DWORD, unsigned long, and unsigned short in VC)

Source: Internet
Author: User

From http://www.easewe.com/Article/Document/606.htm

Typedef unsigned long DWORD;
Typedef int bool;
Typedef unsigned char byte;
Typedef unsigned short word;
Typedef 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 int;
Typedef unsigned int uint;
Typedef unsigned int * puint;

DWORD is actually unsigned long, And uint is unsigned Int.
In a 16-bit Windows system, long is 4 bytes, and INT is only two bytes. They are different;
32-bit windows are 4 bytes, so DWORD and uint are the same in Win32.

Int Is the standard computer's 16-bit number of digits, 32-bit machines, 64-bit machines are 16, 32, 64
8-bit single-chip microcomputer 8-bit long, so int long and other software extensions, for 32-bit win
Int = 32
Long = 32
Short = 16

However, the number of bytes long, short, and INT are also related to the compiler.

You can use sizeof in VC to view its length, as shown in figure

Sizeof (INT) = 4, which indicates that it is 4 bytes, that is, 32 bits;

Since the standards do not specify the specific number of digits, many compilers and platforms use their own standards.
In short, sizeof (long)> = sizeof (INT)> = sizeof (short)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.