On Thu, 2002-07-11 at 19:26, Albert D. Cahalan wrote: > Bastien Nocera writes: > > On Thu, 2002-07-11 at 07:48, Albert D. Cahalan wrote: > >> Bastien Nocera writes: > >>> On Wed, 2002-07-10 at 23:09, Mij wrote: > > >>>> "Signed" is an implicit keyword, and it doesn't implies > >>>> any specific behaviour. It's simply implied. Then, I > >>>> think the problem comes from a gcc optimization. > >> ... > >>> Char on PPC is unsigned. > >> > >> It doesn't have to be. What benefits do we get from > >> being incompatible with the rest of the world? > >> Not that a signed char (negative letters???) makes > >> any sense, but that's the norm. > >> > >> I don't think it would be terribly hard to fix this. > >> At the syscall level, and even at the libc level, > >> there wouldn't be much of an ABI difference at all. > >> If anything, buggy behavior would disappear. > > > > No need to send your humours to me. K&R never said that > > char should be signed, it's not the norm. > > K&R made char signed. > > K&R's compiler didn't have a "signed" keyword at all, > so if char had not been signed then there would not > have been any signed 8-bit type. > > K&R didn't need the 0xff character, so using char in > place of int would generally make no difference. > (Who needs a "LATIN SMALL LETTER Y WITH DIAERESIS" anyway? > I stay out of Latin America, so my little Y doesn't > get the runs; them foreigners can deal with it.) > > Even Microsoft got this right. > > AFAIK, we inherit the unsigned default from AIX. > IBM made char unsigned to match what they'd done > on S/370 and AS/400 hardware. On those platforms, > IBM was using EBCDIC instead of ASCII, and needed > to make char unsigned to prevent regular characters > (basic numbers and letters) from being negative. > > Not many people were dumb enough to follow IBM.
The K&R book doesn't say if it's signed or not, that's up to the implementation. > > People just assume it, "Hey, it works on my machine, > > so it should work everywhere". Next you're gonna tell > > me that MMX assembly should also work on PPC because > > "What benefits do we get from being incompatible with > > the rest of the world?". > > Benefit: a processor that doesn't consume 75 watts > Cost: must use AltiVec assembly instead of MMX assembly > > That was easy. Where's the benefit for unsigned char? Fair enough. > > Your time would be better spent fixing the programs > > that make this wrong assumption. > > Yeah, with -fsigned-char in every Makefile... or fix the > whole lot by changing the gcc default. It's just stupid > to be swimming against the flow on this. Patches willkommen. Knock yourself out. -- /Bastien Nocera http://hadess.net
signature.asc
Description: This is a digitally signed message part