Not to long ago, someone told me that long
are not 64 bits on 64 bit machines and I should always use int
. This did not make sense to me. I have se
It is not clear if the question is about the Microsoft C++ compiler or the Windows API. However, there is no [c++] tag so I assume it is about the Windows API. Some of the answers have suffered from link rot so I am providing yet another link that can rot.
For information about Windows API types like INT
, LONG
etc. there is a page on MSDN:
Windows Data Types
The information is also available in various Windows header files like WinDef.h
. I have listed a few relevant types here:
Type | S/U | x86 | x64 ----------------------------+-----+--------+------- BYTE, BOOLEAN | U | 8 bit | 8 bit ----------------------------+-----+--------+------- SHORT | S | 16 bit | 16 bit USHORT, WORD | U | 16 bit | 16 bit ----------------------------+-----+--------+------- INT, LONG | S | 32 bit | 32 bit UINT, ULONG, DWORD | U | 32 bit | 32 bit ----------------------------+-----+--------+------- INT_PTR, LONG_PTR, LPARAM | S | 32 bit | 64 bit UINT_PTR, ULONG_PTR, WPARAM | U | 32 bit | 64 bit ----------------------------+-----+--------+------- LONGLONG | S | 64 bit | 64 bit ULONGLONG, QWORD | U | 64 bit | 64 bit
The column "S/U" denotes signed/unsigned.