comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Ada Alternatives to Unrestricted_Access
Date: Sun, 11 Mar 2018 10:57:45 +0100
Date: 2018-03-11T10:57:45+01:00	[thread overview]
Message-ID: <p82uip$r76$1@dont-email.me> (raw)
In-Reply-To: <6792fcd7-a25a-417c-b45a-1a17b0168234@googlegroups.com>

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.

Since your type is tagged, parameters are passed by reference, so your "in" 
parameter is a constant view of the variable. As such, it has the same 
representation as the full (non-constant) view of variable.

Nothing in the ARM puts any requirements on the representation of access types, 
so it's possible that access-constant and access-all could have different 
representations. The distinction between the two would seem to be a compile-time 
concept that would not be explicitly represented at run time. Given the general 
rule that compiler writers don't make things more difficult for themselves than 
they need to, it seems unlikely that the access values would have different 
representations, and unchecked converting between them should be OK. Input from 
compiler writers would be more valuable than my uneducated guessing, though.

Since tagged parameters are always aliased, address-to-access conversion should 
always be correct.

Why do you need this function?

-- 
Jeff Carter
"Sir Robin the not-quite-so-brave-as-Sir-Lancelot,
who had nearly fought the Dragon of Angnor,
who nearly stood up to the vicious Chicken of Bristol,
and who had personally wet himself at the
Battle of Badon Hill."
Monty Python & the Holy Grail
68


  reply	other threads:[~2018-03-11  9:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 20:11 Ada Alternatives to Unrestricted_Access Jere
2018-03-07 20:38 ` Dmitry A. Kazakov
2018-03-07 22:29   ` Jere
2018-03-08  8:27     ` Dmitry A. Kazakov
2018-03-09  0:43       ` Jere
2018-03-09  0:52         ` Jere
2018-03-09  8:28           ` Dmitry A. Kazakov
2018-03-11  0:31             ` Jere
2018-03-08  3:18 ` gautier_niouzes
2018-03-09  0:41   ` Jere
2018-03-08 17:51 ` Jeffrey R. Carter
2018-03-09  0:36   ` Jere
2018-03-09 16:46     ` Jeffrey R. Carter
2018-03-11  0:38       ` Jere
2018-03-11  9:57         ` Jeffrey R. Carter [this message]
2018-03-11 10:44           ` Dmitry A. Kazakov
2018-03-11 14:31           ` Jere
2018-03-11 15:49             ` Jeffrey R. Carter
2018-03-11 17:33               ` Jere
2018-03-11 18:12                 ` Jeffrey R. Carter
2018-03-11 19:53                   ` Jere
2018-03-12 16:28                     ` Jeffrey R. Carter
2018-03-11 18:27                 ` Niklas Holsti
2018-03-11 20:07                   ` Jere
2018-03-12 23:35                     ` Randy Brukardt
2018-03-12 23:30         ` Randy Brukardt
2018-03-13  7:46           ` Niklas Holsti
replies disabled

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