Here is the Win32, which is the number of bytes in the X86 compiler configuration
Char 1 bytes;
Short 2 bytes;
int 4 bytes;
Long 4 bytes;
Longlong 8 bytes;
Float 4 bytes;
Double 8 bytes;
A long double of 8 bytes;
wchar_t 2 bytes;
BOOL 1 bytes;
(The pointer is all 4 bytes)
char* 4 bytes;
bool* 4 bytes;
short* 4 bytes;
int* 4 bytes;
long* 4 bytes;
Long long* 4 bytes;
float* 4 bytes;
double* 4 bytes;
Long double* 4 bytes;
wchar_t* 4 bytes;
Other types:
Enum type declaration does not account for memory.
eg. Enum Color {Red, Black}; does not account for memory.
The enum variable definition accounts for the int type memory. The Win32 is 4B.
eg. Color CLR; account for sizeof (int)
Member alignment issues for structs:
For structs, the compiler automatically aligns the members to improve the efficiency of the operation. By default, the compiler allocates space for each member of the struct by its natural alignment (aligned by the largest member of the member in the struct), and each member is stored sequentially in memory in the order in which they are declared.
The structure of a Union (union) is large enough to be equal to the space of one of the longest structure variables, but this longest space satisfies the following conditions:
1. Space greater than or equal to the longest one structure variable
2. And to be able to divide the data length of other structural variables (length least common multiple of the meta-type length).
Summary: Compared with the above, the general variables in the X86 and X64 system length of no difference, the difference is that the range of the pointer is increased from 32 to 64 bits. If you consider the compatibility of programs under 64-bit systems, pointers are the only place to be aware. Transitioning from a 32-bit system to a 64-bit system differs from transitioning from a 16-bit system to a 32-bit system, because the DOS system has only 2 bytes under int, and the Windows system under int is 4 bytes, and the byte count of int is not incremented after transitioning to a 64-bit system. If you use Windows system programming, support for 64-bit requires visual Studio 2005/2008, and earlier versions do not support 64-bit platforms.