Skip to contentSkip to conversation

Can we rely solely on __arch64__

DISCUSSION Sam Ravnborg 2 participants 2 messages Jan 3, 2009

lore
Share & tools
lore
#0 lore raw

Hi David et al.

So far we have in the .h files used:

#if defined(__sparc__) && defined(__arch64__)

But I just tried with the two sparc gcc's I have here. Both (as expected) define __sparc__ and only the sparc64 version define the __arch64__ symbol.

So how about simplifying the checks to read:

#ifdef __arch64__

It is much more strightforward to read. Testing on __sparc__ in the sparc specific header files is a noop. And if the header files are anyway used then the user has much bigger problems than the 32 / 64 bit differences.

I have in the fixed unified ipcbuf.h patch used the simpler format so please do not apply it if you do not agree.

I started to look into this as it did not feel good to use something like this:

#if !(defined(__sparc__) && defined(__arch64__))
sparc specific stuff
#endif

I also tried the alternative:
#if defined(__sparc__) && defined(__arch64__)
#else
sparc specific stuff
#endif

Neither looked 'nice'.

I ended up with:
#ifndef __arch64__
sparc specific stuff
#endif

Which was acceptable.

Sam

#1 lore raw

From: Sam Ravnborg <[email protected]>
Date: Sat, 3 Jan 2009 13:26:46 +0100

Quoted 3 lines

So how about simplifying the checks to read:

#ifdef __arch64__

This seems like a fine thing to do in sparc specific headers.