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,7f18265ce67560b3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.27.132 with SMTP id t4mr1505322pbg.3.1320783109375; Tue, 08 Nov 2011 12:11:49 -0800 (PST) Path: h5ni13770pba.0!nntp.google.com!news1.google.com!postnews.google.com!x36g2000prb.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Memory Access Date: Tue, 8 Nov 2011 12:11:49 -0800 (PST) Organization: http://groups.google.com Message-ID: <56bb9a0a-c838-4cf2-a544-a73e7d124f75@x36g2000prb.googlegroups.com> References: <49f9578c-6f67-4af0-93b0-63120bfe23df@x28g2000prb.googlegroups.com> <35c7e403-6503-4e26-8764-9783caf84871@e2g2000vbb.googlegroups.com> <91ebbfff-9108-4401-9056-963db3f12f9e@o14g2000yqh.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1320783109 21982 127.0.0.1 (8 Nov 2011 20:11:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 Nov 2011 20:11:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x36g2000prb.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: news1.google.com comp.lang.ada:18867 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-11-08T12:11:49-08:00 List-Id: On Nov 8, 9:46=A0am, awdorrin 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