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: a07f3367d7,c9d5fc258548b22a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!transit3.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews7.readnews.com!not-for-mail Date: Fri, 04 Feb 2011 11:00:18 -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> In-Reply-To: <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d4c232a$0$28967$882e7ee2@usenet-news.net> NNTP-Posting-Host: e968dcab.usenet-news.net X-Trace: DXC=eOIHG1UdgYZ6gOR\]RLQaXQFZ3T]GPM]WmX0AG3X_jU_PbP2JgcKIE[VjKk:Lk^BNQcR12TN^Bg7^FhIU742\JVYDB2j=C>ck`[ X-Complaints-To: abuse@usenet-news.net Xref: g2news2.google.com comp.lang.ada:17838 Date: 2011-02-04T11:00:18-05:00 List-Id: On 2/4/2011 4:24 AM, Ludovic Brenta wrote: > Did I mention that *every* time I look at C code I see a bug? > Sometimes, looking twice at the same code reveals two bugs! Here you > do not check that message != NULL; the condition should be: > while (message&& *message != 0) Did I mention that people who criticize C are like people who criticize grammar? Every time they do so, their own criticism contains errors. You make two errors here. The first is to assume without any actual knowledge that it is possible for the argument to be a null pointer; it is likely that the contract for this procedure requires that it not be. The second is that you test for the pointer being null each time through the loop rather than just once.