Path: utzoo!attcan!uunet!mcvax!guido From: guido@cwi.nl (Guido van Rossum) Newsgroups: comp.windows.x Subject: Re: 8bit xterm Message-ID: <342@piring.cwi.nl> Date: 31 May 88 09:39:46 GMT References: <8805241750.AA11835@nirvana.cs.titech.junet> <9740026@hpfclp.SDE.HP.COM> Reply-To: guido@cwi.nl (Guido van Rossum) Organization: The Royal Society for Prevention of Cruelty to Amoebae Lines: 22 In article <9740026@hpfclp.SDE.HP.COM> diamant@hpfclp.SDE.HP.COM (John Diamant) writes: >OK -- I've got something to start the discussion off with. Why is >String (defined by X Toolkit) defined to be char * instead of unsigned char *, >and is there some reason it can't be changed? Use of char * is bad for >the health of characters that need to retain 8-bit integrity. I don't see why this is bad. How could you possibly lose the high bit if the character is signed? Char-to-char transfers copy all 8 bits, even if you use ints as intermediates. Indexing arrays must be done by masking off the sign bits: array[c & 0xff]. This is often recognized by the compiler as a special case. It is also a long-living tradition in C. I have a reason for *not* using unsigned characters: you'll get lint complaints and compiler errors or warnings on the use of perfectly safe functions like strcpy, which have 'char *' as their argument and return type. (And I hate to type 'unsigned'. :-) -- Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam guido@piring.cwi.nl or mcvax!piring!guido or guido%piring.cwi.nl@uunet.uu.net