From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9ca52c8981c1b86a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: One other possible reason for the C predominance Date: Tue, 22 Mar 2011 17:54:37 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1300830877 23456 192.74.137.71 (22 Mar 2011 21:54:37 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 22 Mar 2011 21:54:37 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:3dQIQ5W7EBNHVLNPJnuMA8Okjj0= Xref: g2news1.google.com comp.lang.ada:18387 Date: 2011-03-22T17:54:37-04:00 List-Id: Keith Thompson writes: > Ludovic Brenta writes: >> In fact, C is bad because it assumes a uniform memory architecture and >> a flat address space. ... > No, C doesn't assume this. Right. Some C programmers assume it, either by accident or on purpose. I don't remember K&R C well enough to know whether K and/or R assumed it. But the C standard does not assume it. ... > But all of these operations have undefined behavior if the two > pointers don't point into the same object (or, as a special case, > just past the end of the object.) Since the behavior is undefined, > an implementation could even check for out-of-bounds accesses, > though most don't do so. A C impl could, but it's somewhere between difficult and impossible to do it efficiently. > For C implementations on systems with a flat address space, all > this tends to work as you'd expect (and it makes it very easy to > shoot yourself in the foot by accidentally going outside the bounds > of the object you're working with). But it's entirely possible to > implement C on a system where distinct objects exist in distinct > address spaces. Well, sort of. C programmers on 8086 found it necessary to sprinkle their programs with "near" and "far" all over the place -- which means those programs weren't C. >... This is by deliberate design. Deliberate design by whom? K&R, or later C-standards committees? - Bob