You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

A chosen set of types is refered to in C faqs as a data model, and are named ILP-x, LLP-x or LP-x with x the
processor's wordsize in bits, typically 32 or 64. ILP-x means that Integer, Long and Pointer are x bits wide, LP-x that Long and
Pointer are x bits wide, and LLP that Long Long and Pointer are x bits wide.

Data Type

LP32

ILP32

ILP64

LLP64

LP64

char

8

8

8

8

8

short

16

16

16

16

16

int

16

32

64

32

32

long

32

32

64

32

64

long long

 

 

 

64

pointer

32

32

64

64

64

The following observations are derived from the Development Tutorial by Marco van de Voort [van de Voort 07]:

  • Standard programming model for current (Intel family) PC processors is ILP32.
  • The problem with long in C was that there are both codebases that expect pointer and long to have the same size, while
    there are also large codebases that expect int and long to be the same size. The compability model LLP64 was designed to
    keep the long<->{{int}}compability by introducing a new type to remain compatible with pointer (long long)
    ? long long is only defined for LLP64.
    ? LP32 is used as model for the win-16 APIs of Windows 3.116
    ? Most Unixes use LP64, primarily to conserve memory space compared to ILP64. Examples: 64-bit Linux, FreeBSD, NetBSD, OpenBSD
    ? Win64 uses the LLP64 model (also known as P64). This model conserves type compability between long and int, but looses type compability between long and pointer types. Any cast between a pointer and an existing type requires modification.
    ? ILP64 is the easiest model to work with, since it retains all compability with the much used ILP32 model, except specific assumptions that the core types are 32-bit. However this model requires significant memory, and both code and data size significantly increase.

References

van de Voort 07 Marco van de Voort. Development Tutorial (a.k.a Build FAQ).
January 29, 2007. http://www.stack.nl/~marcov/buildfaq.pdf

Open Group 97 Go Solo 2 - The Authorized Guide to Version 2 of the Single UNIX Specification. ISBN 0-13-575689-8. May 1997. http://www.unix.org/whitepapers/64bit.html

  • No labels