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!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed-0.progon.net!progon.net!news-zh.switch.ch!switch.ch!news.ip-plus.net!newsfeed.ip-plus.net!news.post.ch!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: copying data between memory locations Date: Mon, 03 Sep 2007 12:38:53 +0200 Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) Message-ID: <46dbe442$1@news.post.ch> References: <1188809968.217323.145640@r29g2000hsg.googlegroups.com> NNTP-Posting-Host: 194.41.146.1 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: atlas.ip-plus.net 1188815941 18374 194.41.146.1 (3 Sep 2007 10:39:01 GMT) X-Complaints-To: abuse@ip-plus.net NNTP-Posting-Date: Mon, 3 Sep 2007 10:39:01 +0000 (UTC) User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) In-Reply-To: <1188809968.217323.145640@r29g2000hsg.googlegroups.com> X-Original-NNTP-Posting-Host: w01iwt.pnet.ch X-Original-Trace: 3 Sep 2007 12:38:58 +0200, w01iwt.pnet.ch Xref: g2news2.google.com comp.lang.ada:1675 Date: 2007-09-03T12:38:53+02:00 List-Id: jef.mangelschots@gmail.com schrieb: > 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. straightforward and highly dangerous. > I can't figure out a way to do this in Ada (at least not Ada83). You just have not found the right features yet. Suggested reading: http://en.wikibooks.org/wiki/Ada_Programming/Types/access#Access_vs._System.Address http://en.wikibooks.org/wiki/Ada_Programming/Type_System#Address_conversion http://en.wikibooks.org/wiki/Ada_Programming/Type_System#Overlays and from the reference manual: http://www.adaic.com/standards/05rm/html/RM-13-7-2.html#I4643 http://www.adaic.com/standards/05rm/html/RM-13-3.html#I4496 As you can see (once you read the articles) you have even got two options open and now you are left with choosing the right one ;-). Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com