Jim Segrave wrote:
> In article <[EMAIL PROTECTED]>,
> dwelch91  <[EMAIL PROTECTED]> wrote:
>> I need to detect whether the operating system I am running on (not the 
>> Python version) is 64bit or 32bit. One requirement is that I need to 
>> include support for non-Intel/AMD architectures.
>>
>> The 2 ways I have thought detecting 64bit are:
>>
>> 1. struct.calcsize("P") == 8
>> 2. '64' in os.uname()[4]
>>
>> I'm not convinced that either one of these is really adequate. Does 
>> anybody have any other ideas on how to do this?
> 
> Does sys.maxint give what you need? 
> 
> I think for most machines this will give you the answer you are
> looking for - either 2**31 -1 for a 32 bit version or 2**63-1 for a 64
> bit version. It's set up during the configure phase of building python

No. Some 64-bit systems (notably Win64) leave C longs as 32-bit. This is known 
as the LLP64 data model.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to