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,565ddc0e6b80e338 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: copying data between memory locations References: <1188809968.217323.145640@r29g2000hsg.googlegroups.com> In-Reply-To: <1188809968.217323.145640@r29g2000hsg.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1188840166 12.201.97.213 (Mon, 03 Sep 2007 17:22:46 GMT) NNTP-Posting-Date: Mon, 03 Sep 2007 17:22:46 GMT Organization: AT&T ASP.att.net Date: Mon, 03 Sep 2007 17:22:46 GMT Xref: g2news2.google.com comp.lang.ada:1711 Date: 2007-09-03T17:22:46+00:00 List-Id: jef.mangelschots@gmail.com wrote: > In our current design, we have a package that maintains a list of > descriptors of various buffers in the application. We don't want to > know their datatypes or how to write data into them. We only want to > maintain a physical address of them and use that address to directly > write data into these buffers (this data comes out incoming packets > over the network). > > In C, this is very straightforward and use the address as a pointer > and simply copy the packet into the memory location. It's also very easy to accidentally read/write data from/into the wrong buffer, ... > I can't figure out a way to do this in Ada (at least not Ada83). Probably because you've decided on a very C-like implementation. Maybe there's information you're not giving us, but I see no reason from your posting why you have to maintain physical addresses and use them to write data directly into memory. Maybe there is a reason that you didn't think important to give us, or maybe it's just that you're used to thinking in low-level, C-like concepts. My experience is, with people who say "this is very easy/simple/whatever in C", it's generally the latter. If you model your problem as a set of package specifications, model their behavior using state-transition diagrams or the like, and implement the bodies using standard Ada constructs, things are straightforward in Ada at least as often as they are in C. -- Jeff Carter "Many times we're given rhymes that are quite unsingable." Monty Python and the Holy Grail 57