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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.18.138 with SMTP id 10mr20440861ios.106.1520556108205; Thu, 08 Mar 2018 16:41:48 -0800 (PST) X-Received: by 10.157.68.9 with SMTP id u9mr1449280ote.5.1520556108064; Thu, 08 Mar 2018 16:41:48 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!r195no123477itc.0!news-out.google.com!a2-v6ni212ite.0!nntp.google.com!e10-v6no122778itf.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 8 Mar 2018 16:41:47 -0800 (PST) In-Reply-To: <79006263-c9a7-497a-af50-de9e5045af07@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.218.250; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.218.250 References: <79006263-c9a7-497a-af50-de9e5045af07@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <47a66da9-1862-459c-b236-562417b31f0d@googlegroups.com> Subject: Re: Ada Alternatives to Unrestricted_Access From: Jere Injection-Date: Fri, 09 Mar 2018 00:41:48 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2846 X-Received-Body-CRC: 3281107613 Xref: reader02.eternal-september.org comp.lang.ada:50901 Date: 2018-03-08T16:41:47-08:00 List-Id: On Wednesday, March 7, 2018 at 10:18:47 PM UTC-5, gautier wrote: > I had the same problem for GL[U[T]] bindings (work on both GNAT and Objec= tAda, and perhaps other Ada systems) [1]. A quick search with AZip (shamele= ss plug :-) [2] leads to=20 > package A2A_double is new System.Address_To_Access_Conversions(Double); > ... > procedure Vertex (v: Double_Vector_3D) is > begin > Vertex3dv(A2A_double.To_Pointer(v(0)'Address)); > -- This method is functionally identical > -- to using GNAT's 'Unrestricted_Access > end Vertex; >=20 > Other places use an Unchecked_Conversion. > The GNAT doc says: > "The Unrestricted_Access attribute is similar to Access except that all a= ccessibility and aliased view checks are omitted. This is a user-beware att= ribute. It is similar to Address, for which it is a desirable replacement w= here the value desired is an access type. In other words, its effect is ide= ntical to first applying the Address attribute and then doing an unchecked = conversion to a desired access type." >=20 > ___ >=20 > [1] https://globe3d.sourceforge.io/ > [2] https://azip.sourceforge.io/ Yep, that's basically the same conclusion I came to. My doubts center around whether it is legit in portable Ada to do so to bypass the "in" mode. I don't know if the language allows for a compiler to use different representations for a constant variable and a mutable variable. If so, what I am doing might possibly be erroneous behavior. It would work in GNAT based on the section you quoted, but I was curious if it would run afoul in other compilers possibly.