Subject: Generic LP64 define?
To: None <tech-toolchain@netbsd.org>
From: Eduardo Horvath <eeh@turbolinux.com>
List: tech-toolchain
Date: 08/02/2000 16:09:06
Now to detect a system that's LP64 we need to check a special define for
each architecture. Now it's something like:
#if defined(__alpha__) || defined(__sparc_v9__)
or
#if defined(__alpha__) || (defined(__sparc__) && defined(__arch64__))
If we start having 64-bit POWER/PPC, 64-bit MIPs, or ia64, these checks
will quickly become unweildy.
I propose we add a new define to the gcc specs file to identify a 64-bit
target so we don't have to keep messing about with architecture specific
defines.
Alternatively we can change these to compare LONG_MAX to INT_MAX as
follows:
#if (LONG_MAX > INT_MAX)
/* LP64 code */
#else
/* ILP32 code */
#endif
However, this requires <sys/limits.h> and does not properly identify the
width of a pointer.
Eduardo Horvath