NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [9.1 AMD64 gcc] How to distinguish between AMD64 and I386 from C code?



Thanks for your comments!

The deal appeared to be somewhat more complex than just 'check some magic define that will work everywhere'.
So now I understand that the correct way is to collect defines for as many CPUs/OSes/compilers as possible,
in a way like:
#if( defined(__x86_64__) || defined(__aarch64__) || ... )

My target was to determine whether the registers of the CPU are 64bit, so that sizeof(void *) and #ifdef _LP64 (as pointed by Jeffrey) won't fit (because of x32 and some other ABIs like N32 for MIPS).


Home | Main Index | Thread Index | Old Index