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: a07f3367d7,c9d5fc258548b22a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.158.31.10.MISMATCH!newsfeed-0.progon.net!progon.net!news-zh.switch.ch!switch.ch!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 03 Feb 2011 12:03:59 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; 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> In-Reply-To: <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4d4a8b9f$0$6773$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 03 Feb 2011 12:03:59 CET NNTP-Posting-Host: bdb8dfc3.newsspool3.arcor-online.net X-Trace: DXC=QQE5>m7_e=dEB;5>eE0T7mMcF=Q^Z^V3h4Fo<]lROoRa8kFkKdknnc\616M64>jLh>_cHTX3jmK\n5ThUHYYc X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:17814 Date: 2011-02-03T12:03:59+01:00 List-Id: On 03.02.11 09:24, Ludovic Brenta wrote: >> unsigned int print(char *message, unsigned int line) >> { >> char *vidmem = (char *) 0xb8000; >> unsigned int i= 0; >> >> i=(line*80*2); >> >> while(*message!=0) // 24h >> { >> vidmem[i]= *message; >> *message++; > > *Every* time I look at C code, I see a bug. > I think this is a bug; it should read "message++" since you want to > increment the pointer, not the pointed-to character. This is not a bug, since postfix ++ has higher precedence than *. Indeed, *t++ = *s++; is idiomatic C. While the result of the * operation on the pre-incremented pointer doesn't seem to have a visible effect in this program, it still might be intended, the intention possibly being to read the contents of (possibly volatile) location *message, ahead of time. Who knows? It might just as well be a c&p issue.