Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Standard programming model for current (Intel family) PC processors is ILP32.
  • One issue 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 preserve long and int compability by introducing a new type to remain compatible with pointer (long long)
  • LLP64 is the only data model that defines a size for the long long type.
  • LP32 is used as model for the win-16 APIs of Windows 3.1.
  • Most Unixes use LP64, primarily to conserve memory space compared to ILP64, including: 64-bit Linux, FreeBSD, NetBSD, and 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, because it retains compability with the ubiquitous 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.

Risk Assessment

Understanding the data model used by your implementation is necessary to avoid making errors about the range of values that can be represented using integer types.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

INT00-A

1 (low)

1 (unlikely)

1 (low)

P1

L3

References

Wiki Markup
\[[van de Voort 07]\] Marco van|AA. C References#van de Voort. Development Tutorial (a.k.a Build FAQ). January 29, 2007. http://www.stack.nl/~marcov/buildfaq.pdf
Wiki Markup
07]\] 
\[[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|AA. C References#Open Group 97b]\]