Skip to contentSkip to conversation

(no subject)

DISCUSSION Bob Brose 2 participants 2 messages Oct 3, 2005

lore
Share & tools
lore

Bob Brose

author
#0 lore raw

I'm trying to fix some of the AX25 code in the 2.6 kernel and traced down a problem to the use of a char var which was being assigned the value of -1. On x86 when the var was compared to -1 it succeded but on PPC it failed. So I tried a simple test:

main()
{
char atest;
atest=-1;
printf("%i,%X\n",atest,atest);
}

With GCC 3.3.5 on 2.6.14-rc1 x86 I get:
./atest
-1,FFFFFFFF

With GCC 3.3.5 on 2.6.14-rc1 PPC I get:
./atest
255,FF

If I change the declaration of atest to a signed char on PPC I get the same result as x86.

Does this mean the char in x86 is signed and in PPC it's unsigned? Has it always been thus?

#1 lore raw
Quoted 1 line · Bob Brose

Does this mean the char in x86 is signed and in PPC it's unsigned?

Yes.

Quoted 1 line

Has it always been thus?

Yes.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."