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=0.6 required=5.0 tests=BAYES_00,LOTS_OF_MONEY, TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6401faa712588412 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-17 12:27:07 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <9lje36$ijn$1@houston.jhuapl.edu> Subject: Re: Access to tagged type parameters Message-ID: <%def7.5255$2u.51636@www.newsranger.com> X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Fri, 17 Aug 2001 15:26:51 EDT Organization: http://www.newsranger.com Date: Fri, 17 Aug 2001 19:26:51 GMT Xref: archiver1.google.com comp.lang.ada:12071 Date: 2001-08-17T19:26:51+00:00 List-Id: In article , David Brown says... > >Jonathan DeSena 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