comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Access to tagged type parameters
Date: Fri, 17 Aug 2001 19:26:51 GMT
Date: 2001-08-17T19:26:51+00:00	[thread overview]
Message-ID: <%def7.5255$2u.51636@www.newsranger.com> (raw)
In-Reply-To: pybf7.17453$ZM2.1548231@newsread2.prod.itd.earthlink.net

In article <pybf7.17453$ZM2.1548231@newsread2.prod.itd.earthlink.net>, David
Brown says...
>
>Jonathan DeSena <jonathan.desena@jhuapl.edu> wrote:
>
>> "All formal parameters belonging to tagged 
>> types are implicitly declared to be aliased. This allows a subprogram to 
>> create access values pointing to its tagged formal parameters using the 
>> 'Access attribute ..." (section 12.6.2, page 579 in my version)
>> 
>> non-local pointer cannot point to local object
>
>>      B_Access: A_Access_Type;
>
>The pointer access type A_Access_Type has a scope outside of the scope of
>the object you getting the access value of.  

Actually, it doesn't though. The actual pointed-to object is B, which is
declared at the same scope as A_Access_Type.

It looks like the compiler is considering C (the formal parameter) to be the
pointed to object instead of B (the actual parameter). I guess it can do that,
but then I don't much see the point of the rule specifying that tagged types are
always passed by reference. By this rule a tagged by-value pointer would be just
as safe (and useful). I guess it still has use for 'Unchecked_Access...

FWIW, GreenHills tags the same line with the following error:
LRM:3.10.2(28), The prefix to 'ACCESS shall not be statically deeper than that
of the expected type, Continuing

>If you use 'Unchecked_Access,
>you will get the access you want, however, the it is up to you to make sure
>it doesn't go outside of scope.

Another possibility is to use the "access" parameter mode instead of "in out".
In that case, the accessability rules seem to behave as I would expect.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



  reply	other threads:[~2001-08-17 19:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-17  9:16 Access to tagged type parameters Jonathan DeSena
2001-08-17 16:23 ` David Brown
2001-08-17 19:26   ` Ted Dennison [this message]
2001-08-17 13:55     ` Jonathan DeSena
2001-08-17 21:51       ` Ted Dennison
2001-08-20 14:03         ` Jonathan DeSena
2001-08-17 21:45 ` tmoran
replies disabled

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