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.39.84 with SMTP id n81mr2913071ion.130.1520778691962; Sun, 11 Mar 2018 07:31:31 -0700 (PDT) X-Received: by 10.157.0.5 with SMTP id 5mr277960ota.0.1520778691860; Sun, 11 Mar 2018 07:31:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!e10-v6no953217itf.0!news-out.google.com!a25ni2434itj.0!nntp.google.com!r195no957597itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 11 Mar 2018 07:31:31 -0700 (PDT) In-Reply-To: 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: <4ab69a18-5766-446c-85c2-14e094199c95@googlegroups.com> <6792fcd7-a25a-417c-b45a-1a17b0168234@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5c448ce7-5646-45c5-b221-3d9c884c4d52@googlegroups.com> Subject: Re: Ada Alternatives to Unrestricted_Access From: Jere Injection-Date: Sun, 11 Mar 2018 14:31:31 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2662 X-Received-Body-CRC: 2539315669 Xref: reader02.eternal-september.org comp.lang.ada:50927 Date: 2018-03-11T07:31:31-07:00 List-Id: On Sunday, March 11, 2018 at 5:57:47 AM UTC-4, Jeffrey R. Carter wrote: > On 03/11/2018 01:38 AM, Jere wrote: > > On Friday, March 9, 2018 at 11:46:03 AM UTC-5, Jeffrey R. Carter wrote: > >> > >> OK, that's what I missed. I guess you could unchecked convert from > >> access-constant to access-all. > >> > > My only concern with this is does the Ada language allow it portably? I > > know it works in GNAT, but what I couldn't find is if the RM allowed > > for a constant variable to have a different internal representation than > > a non constant version of the variable. If that were the case, then I > > would be worried that doing an unchecked_conversion (or an > > Address_To_Access_Conversion) could provide an erroneous result. > > > > Why do you need this function? > It's iterator related. In order to iterate through a container in all contexts, the Default_Iterator function needs a parameter of mode "in". In order to leverage the anti tamper functionality, the iterator needs a non constant access to the container to be supplied when building the iterator inside the Default_Iterator function (so it can modify the tamper state of the container). The GNAT body for the Vectors package has an example (I think it is a-convec.adb, just search for "function iterate" and look for the one that returns an iterator).