What is the bit size of long on 64-bit Windows?

Reference:

  1. What is the bit size of long on 64-bit Windows?
  2. sizeof unsigned int in microsoft x64-compiler

Q: Why is the sizeof(unsigned int) equal to 4 instead of 8?

Because Windows x64 uses the LLP64 programming model, in which int and long remain 32 bit, but long long and pointers are 64 bit.

Type LP32 ILP32 ILP64 LP64 (UNIX) LLP64 (Windows)
char 8 8 8 8 8
short 16 16 16 16 16
int 16 32 64 32 32
long 32 32 64 64 32
long long 64 64 64 64 64
pointer 32 32 64 64 64

ILP32 : 'Int, Long and Pointer are 32 bit'

The ILP64 system was abandoned in favour of LP64 (that is, almost all later entrants used LP64, based on the recommendations of the Aspen group; only systems with a long heritage of 64-bit operation use a different scheme). All modern 64-bit Unix systems use LP64. MacOS X and Linux are both modern 64-bit systems.

Microsoft uses a different scheme for transitioning to 64-bit: LLP64 ('long long, pointers are 64-bit'). This has the merit of meaning that 32-bit software can be recompiled without change. It has the demerit of being different from what everyone else does, and also requires code to be revised to exploit 64-bit capacities. There always was revision necessary; it was just a different set of revisions from the ones needed on Unix platforms.

results matching ""

    No results matching ""