Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cca!mirror!ima!johnl From: johnl@ima.ISC.COM (John R. Levine) Newsgroups: comp.lang.c Subject: Re: Intel && C (was: Passing (char *) NULL) Message-ID: <727@ima.ISC.COM> Date: Tue, 29-Sep-87 13:25:34 EDT Article-I.D.: ima.727 Posted: Tue Sep 29 13:25:34 1987 Date-Received: Wed, 30-Sep-87 07:25:11 EDT References: <166@qetzal.UUCP> <157@hobbes.UUCP> <875@bsu-cs.UUCP> <882@mcgill-vision.UUCP> <104@nusdhub.UUCP> Reply-To: johnl@ima.UUCP (John R. Levine) Organization: Not enough to make any difference Lines: 45 Keywords: MSC,NULL segments Summary: 8086 has nothing to do with C's typed pointers In article <104@nusdhub.UUCP> rwhite@nusdhub.UUCP (Robert C. White Jr.) writes: >In article <882@mcgill-vision.UUCP>, mouse@mcgill-vision.UUCP (der Mouse) writes: >> So, Ron, what *is* a "flat linear address space"? > A "flat linear address space" is a particularly apt discription >of exactly what INTEL does NOT provide. Because the Segmenting and >segment registers used by the x86 family are the way they are, there >are many valid segment-offset pairs which refer to the same actual >mechanical place in memory. Well, yes and no. If you're on a 286 or 386 running in user mode, your address space is still segmented but the segments are usually disjoint, so there is only one address for any addressable location (disregarding the obnoxious fact that the low two bits of the segment number are mode bits which are ignored in user mode.) It may not be linear, but it's flat. But this misses the point. Too many of the postings here seems to suffer from a myopia that sees only two machine architectures, the Vax (and its cousins, the 32000 and 68000) and the 8086. There are a lot of other machines out there that do not have linear byte-addressable memory. For example, Unisys makes two mainframe lines, the ex-Burroughs line with 48 bit words, and the ex-Sperry Univac line with 36 bit words. Honeywell or their French sucessors also make a word addressed 36 bit line. CDC makes a sixty-bit line with character strangeness that put the "packed" keyword into Pascal. I hear there are even a few PDP-10s and DEC-20s still running. All of these machines have addressing hacks that let you address characters, but the way you address a word is invariably simpler than the way you address a character, and you can't turn a word pointer into a character pointer without fiddling a few bits. C has been running on most of these machines for quite a while, in the Honeywell case for a lot longer than it's been on a Vax. It's entirely possible to write reasonable portable C code that runs on any of them. But you can't assume that all pointers are interchangeable, nor that there is a word of zeros at location zero. It is a tribute to the elegance of dmr's design that the data model of C fits so well on all of these machines without adding a lot of crud to the language. The 8086 has nothing to do with it. (If I were in the mood for a cheap shot, I'd mention that C actually fits the 8086 quite badly, which is why 8086 C has extra keywords like near and far and cdecl to get around its peculiar segmentation, and I don't see near and far anywhere in the standard.) -- John R. Levine, IECC, PO Box 349, Cambridge MA 02238-0349, +1 617 492 3869 { ihnp4 | decvax | cbosgd | harvard | yale }!ima!johnl, Levine@YALE.something The Iran-Contra affair: None of this would have happened if Ronald Reagan were still alive.