Messages in this thread | | | Subject | Re: ARCH32BIT, ARCH64BIT defines | From | (Aaron M. Ucko) | Date | 19 Dec 1997 12:57:06 -0500 |
| |
Pavel Machek <pavel@Elf.mj.gts.cz> writes:
> Sometimes through the code (like in printk( "%08lx" );) knowing > whether architecture is 32 or 64 bit would be nice. Yes, you can do it > by if ((sizeof( long))==4) and hope that gcc optimizes it right, but > this is more convient: > > #ifdef ARCH32BIT > #define X "8" > #else > #define X "16" > #endif
I suggest autoconf's approach to naming:
#if SIZEOF_LONG=4 #define X "8" #elif SIZEOF_LONG=8 #define X "16" #else #error Fix me to deal with your long size. #endif
-- Aaron M. Ucko <amu@mit.edu> (finger amu@monk.mit.edu) [Stark raving sane]
| |