Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!guido From: guido@mcvax.uucp (Guido van Rossum) Newsgroups: comp.lang.c Subject: Re: machines with oddball char * formats Message-ID: <7152@boring.mcvax.UUCP> Date: Thu, 20-Nov-86 05:12:58 EST Article-I.D.: boring.7152 Posted: Thu Nov 20 05:12:58 1986 Date-Received: Thu, 20-Nov-86 23:24:52 EST References: <1534@batcomputer.tn.cornell.edu> Reply-To: guido@mcvax.uucp (Guido van Rossum) Organization: "Stamp Out BASIC" Committee, CWI, Amsterdam Lines: 39 Apparently-To: rnews@mcvax In article <1534@batcomputer.tn.cornell.edu> garry%cadif-oak@cu-arpa.cs.cornell.edu writes: >Forgive my ignorance, but why don't the compiler writers on these "odd" >machines just designate a "char" and a "byte" to be the identical width >to a "short" ? What will go wrong ? > >(Would very many real-life application programs actually be hurt by the >added memory usage? - I'm excluding text editors!) You'll have to exclude a lot more programs (think of {n,t}roff, and all sorts of "compiler"-type programs like awk, dc and bc). Another reason is compatibility with the rest of the world on such systems. Text files are usually written in a packed format (using 2 bytes per word if you have 16- or 18-bit words), so stdio or the read/write system calls would have to do a lot of (un)packing. String parameters to the native operating system also have to be converted, of course -- not an unsurmountable problem for the standard library, but a real pain in some part of the body for system hackers. And such system hackers have always been a big part of the C community! (May that's changing now; it certainly was true a few years ago when these compilers were designed). On the CDC Cyber I have used a few systems like this. The BCPL compiler did not waste an entire word (60 bits!) for a character, but rather packed 7 ASCII characters in it, rather than 10 Display Code characters as the standard convention on this machine. Nice, until you start reading binary files and occasionally have to extract strings from them... The Algol-68 compiler, on the other hand, *did* wast a 60-bit word for a character. I had to do all my system hacking in assembler or (gasp!) Fortran. - - - But then again, you mention "real-life applications". I suppose this is a fairly restricted class of programs, only applying to programs over 10,000 lines of source code, generally dealing with image processing or statistics... Guido van Rossum, CWI, Amsterdam