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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!transit3.readnews.com!news-out.readnews.com!postnews7.readnews.com!not-for-mail Date: Fri, 04 Feb 2011 13:35:14 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <4d4c232a$0$28967$882e7ee2@usenet-news.net> <1p4rkrzxjiswj.bbf2pfuxq0dn$.dlg@40tude.net> In-Reply-To: <1p4rkrzxjiswj.bbf2pfuxq0dn$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d4c477a$0$5229$882e7ee2@usenet-news.net> NNTP-Posting-Host: 16017e8f.usenet-news.net X-Trace: DXC=`mZDC:HP?]Z=GmOQnDdCEPQFZ3T]GPM]WmX0AG3X_jU_\g[h0gH2]JQ90V@UkD_BFP[^oPZAU8TE\Mb=BbILoWL^_bL6VcMRad[ X-Complaints-To: abuse@usenet-news.net Xref: g2news2.google.com comp.lang.ada:17848 Date: 2011-02-04T13:35:14-05:00 List-Id: On 2/4/2011 12:40 PM, Dmitry A. Kazakov wrote: > nobody really understands C, there is no way to reason about > C without running into errors. C has an ISO standard which describes the language. > You just made the error of which you accused Ludovic. You assumed a > contract that the pointer cannot be modified within the loop, e.g. upon > video buffer modification. The pointer *is* modified within the loop, by incrementation. If that pointer were situated within the video buffer itself, the program could behave very oddly indeed, but such behavior would almost certainly by undefined by terms of the standard and it's unlikely that it would be "saved" by adding a check for nullity in each iteration. You could achieve the same oddness in Ada in the same way, by forcing the program to place a pointer in the video buffer. In both languages, the pointer would never be there on its own. > Quality of a programming language is in great part about how close > different people could understand explicit and implied contracts when > reading the code. The implicit contract of the subroutine is that it receives a null-terminated string that's copied to a specified line of the video buffer. It does no checking that the message is not null, that the message is short enough, and that the line is within range, so that needs to be done before the function is called.