comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Memory Access
Date: Tue, 8 Nov 2011 12:11:49 -0800 (PST)
Date: 2011-11-08T12:11:49-08:00	[thread overview]
Message-ID: <56bb9a0a-c838-4cf2-a544-a73e7d124f75@x36g2000prb.googlegroups.com> (raw)
In-Reply-To: 91ebbfff-9108-4401-9056-963db3f12f9e@o14g2000yqh.googlegroups.com

On Nov 8, 9:46 am, awdorrin <awdor...@gmail.com> wrote:
>
> Now I just have to try to understand what is actually going on with
> those commands.
>
> I'm assuming that the subtype is setting the bounds on the array. so
> that the Dev_Table_Ptr_Type is now able to see the elements.

Something like that.  The subtype declaration says that every object
of that subtype has those bounds.  This also means that for any object
X of type Dev_Table_Ptr_Type, X.all has those bounds too.  The reason
that's important is because the bounds don't have to be stored
somewhere else.  If you have an access-to-an-unconstrained array, then
for any object X with that access type, the bounds have to be stored
somewhere along with X.  The problem is that it's left up to the
implementation just how to store those bounds.  It looks like AdaMulti
makes X a three-word object containing a data address, the lower
bound, and the upper bound; while GNAT stores them differently.


> The Dev_Table_Pointer.To_Pointer is mapping the address to an access
> type.
> I'm not quite sure I understand why the package definition for
> Dev_Table_Pointer is needed - and why
> System.Address_To_Access_Conversions cannot be used directly... i'm
> guessing its due to Ada type checking?

System.Address_To_Access_Conversions is a generic package.  You can't
use a generic package directly; you have to instantiate it.  In this
case, you have to instantiate it with a type.  And yes, I think that
this needs to be a generic because of type checking; Ada doesn't have
the equivalent of a (void *) that you can typecast willy-nilly between
other pointer types and screw yourself up royally.

                        -- Adam



  reply	other threads:[~2011-11-08 20:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 20:09 Memory Access awdorrin
2011-11-07 21:26 ` Simon Wright
2011-11-07 22:03 ` anon
2011-11-07 22:21 ` Adam Beneschan
2011-11-07 22:42   ` Adam Beneschan
2011-11-07 23:13   ` Simon Wright
2011-11-07 23:32     ` Adam Beneschan
2011-11-08 12:22       ` awdorrin
2011-11-08 16:00         ` Adam Beneschan
2011-11-08 17:46           ` awdorrin
2011-11-08 20:11             ` Adam Beneschan [this message]
2011-11-08 20:24               ` awdorrin
2011-11-09 14:42                 ` awdorrin
2011-11-08 16:10         ` awdorrin
2011-11-08 18:33           ` Simon Wright
2011-11-08 18:34             ` Simon Wright
2011-11-08 20:18             ` awdorrin
2011-11-08 12:44       ` Simon Wright
2011-11-07 22:26 ` Niklas Holsti
2011-11-07 22:53   ` Adam Beneschan
replies disabled

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