comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: copying data between memory locations
Date: Mon, 03 Sep 2007 12:38:53 +0200
Date: 2007-09-03T12:38:53+02:00	[thread overview]
Message-ID: <46dbe442$1@news.post.ch> (raw)
In-Reply-To: <1188809968.217323.145640@r29g2000hsg.googlegroups.com>

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



  reply	other threads:[~2007-09-03 10:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-03  8:59 copying data between memory locations jef.mangelschots
2007-09-03 10:38 ` Martin Krischik [this message]
2007-09-04 15:57   ` Adam Beneschan
2007-09-04 18:16     ` jef.mangelschots
2007-09-04 20:12       ` Jeffrey R. Carter
2007-09-03 11:09 ` Niklas Holsti
2007-09-03 16:26 ` Steve
2007-09-03 17:22 ` Jeffrey R. Carter
2007-09-04 11:31 ` Stephen Leake
2007-09-05  4:39 ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox