The Bit Size of 'long' in 64-bit Windows
The question arises: why is 'long' not 64 bits on 64-bit machines like Windows? This article delves into the history and implications of integer sizing on different platforms.
History of Integer Sizing
In the Unix world, two major integer size arrangements for 64-bit platforms emerged: ILP64 (int, long, pointers are 64-bit) and LP64 (long, pointers are 64-bit). ILP64 was abandoned in favor of LP64, which became the standard for modern 64-bit Unix systems like macOS X and Linux.
Microsoft's LLP64 Scheme
Microsoft employs LLP64 (long long, pointers are 64-bit) for 64-bit Windows, allowing recompilation of 32-bit software without changes. However, this differs from other 64-bit platforms and requires additional code adjustments to exploit 64-bit capabilities.
Platform-Neutral Integer Types
To approach integer sizing cross-platform, the C99 standard provides the
Considerations for Windows
As Windows uses LLP64, it's crucial to note that 'long' remains 32 bits on 64-bit machines. This necessitates care when utilizing system types, which may deviate from platform-neutral integer types.
Conclusion
Understanding the nuances of integer sizing on different platforms is essential for developing cross-platform software. Utilizing platform-neutral integer types from
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3