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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: How can one record component be local and another not? Date: Tue, 5 May 2020 22:04:51 +0300 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net RZyanpWPrXPJlesi9yG7+w8vUKMEW4ddM7G83Lo+27zPqHolpR Cancel-Lock: sha1:m0WwAjG+Atfd6je7jvA4o9X0sWI= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58603 Date: 2020-05-05T22:04:51+03:00 List-Id: On 2020-05-05 20:32, hreba wrote: > Ok, with all your hints I came to the following solution: > > -- > package Aux is >    type Integer_P is access all Integer; >    type Rec is limited record >       a: aliased Integer; >       p: Integer_P; >    end record; > >    procedure Init (r: access Rec); > end Aux; > -- > package body Aux is >    procedure Init (r: access Rec) is >    begin >       r.p:= r.a'Access; >    end Init; > end Aux; > -- > with Aux; > procedure Test is >    r:    aliased Aux.Rec; > begin >    Aux.Init (r'Access); > end Test; > -- > > It compiles nicely, and then: > > frank@pc-frank:~/Temp/Test0$ ./test > raised PROGRAM_ERROR : aux.adb:4 accessibility check failed > > #@!!0ßx*~@!!! Ok, apologies if I led you down the wrong path. I admit I did not build a running program to check my suggestion of the "access" parameter, and I have not myself often used this kind of code. You should be able to get rid of this error by using r.a'Unchecked_Access instead of r.a'Access, and then (I think) you can return to using an "in out" parameter mode instead of "access" mode. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .