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: a07f3367d7,d23826ff0acb491b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!z3g2000prd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Gem 39 - compiler specific? Date: Thu, 3 Sep 2009 10:27:57 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1bf4b63a-1e2d-41f1-97c6-8324d4b829ff@z3g2000prd.googlegroups.com> References: <9e0bbbcd-260f-48ed-8043-d6280c633e85@h3g2000yqa.googlegroups.com> <19268dbw82hf4.aii8as09aapk.dlg@40tude.net> <4bff103b-1797-4e2b-9dcf-7466b667c59b@d9g2000prh.googlegroups.com> <1s8kuin5t96vr$.1taw9mluqlplz$.dlg@40tude.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1251998878 3287 127.0.0.1 (3 Sep 2009 17:27:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 3 Sep 2009 17:27:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z3g2000prd.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; 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),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8133 Date: 2009-09-03T10:27:57-07:00 List-Id: On Sep 3, 9:38=A0am, "Dmitry A. Kazakov" wrote: > On Thu, 3 Sep 2009 08:26:50 -0700 (PDT), Adam Beneschan wrote: > > On Sep 3, 12:26=A0am, "Dmitry A. Kazakov" > > wrote: > >> Skewed address is not a problem here. The problem is that > >> System.Address_To_Access_Conversions should take an access type as a > >> parameter rather than declare it new. This makes its use quite limited= . > > > I don't see any limitation, at least where To_Pointer is concerned > > (which is what the above code needed to use). =A0If you declare an > > instance of this package for any object type T: > > > =A0 type Convert_T_Access is new System.Address_To_Access_Conversions > > (T); > > > then an object of type Convert_T_Access.Object_Pointer can be > > converted to any access type whose designated type is T. =A0I checked > > through the legality rules in 4.6, and I couldn't find a way to > > declare an access-to-T type that you couldn't convert an > > Object_Pointer to. =A0Thus, if you have any access type > > > =A0 type Acc_T is access T; =A0[or access all T, or access constant T] > > > you can convert an address Addr to an Acc_T by saying: > > > =A0 Acc_T (Convert_T_Access.To_Pointer (Addr)) > > But Acc_T is a pool-specific access, while Address_To_Access_Conversions > creates a general access type. Sigh... I missed that---you can't convert a general access type to a pool-specific one. 4.6 can be hard to follow, the way it's organized, but that's not a good excuse. I've read it enough times that I should know better. However, one could make that case that if you declare a pool-specific access type, then by definition it should point to something that's in a pool; and that if you want an access that could point to an arbitrary address (as Access_To_Address_Conversions would let you do), you should use a general access type. -- Adam