> Hi,

Hi,

> 
> I'm lookking for my package tmview for a C solution to determine whether
> an architecture is 32 or 64 bit.
> 
> [.... code deleted ...]

> Could anyone point me to a better way to handle this?

If you need this at run-time, the ofvious way is to check, if sizeof(long) or 
whatever
provides the bytecount of a LP64/ILP32 programming model.

If the information is needed at compile-time, check unistd.h, were 
_XBS_LP64_OFF64 is
set. The relevant includes are:

bits/posix_opt.h, bits/environments.h and bits/wordsize.h

The selection, which programming model is used, is controlled there in a fairly 
detailed
manner, which has the advantage of being "The POSIX Way(TM)", and therefore even
portable outside the Linux world ( can anybody with access to a True64 System 
check this
claim ? I would be interested... )

Depending on what specific aspects of the machine's wordsize you need, you can 
go as
straight as checking if __WORDSIZE is set to 32 or 64, or as controlled as 
checking if
_XBS5_LP64_OFF64 provides a 64-bit pointer environment.

Have a look at the include-files i named above. I doubt, you'll find a 
situation not being
covered there ;-)
 
> Thanks in advance
> Adrian

Regards,
Thomas

-- 
Thomas Weyergraf                                                [EMAIL 
PROTECTED]
My Favorite IA64 Opcode-guess ( see arch/ia64/lib/memset.S )
"br.ret.spnt.few" - got back from getting beer, did not spend a lot.


Reply via email to