From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: 'address on a subprogram parameter Date: Tue, 20 Apr 2021 18:35:01 +0200 Organization: Adalog Message-ID: References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 20 Apr 2021 16:35:05 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="8fddbc7caabab45c3419096c43f4ac1d"; logging-data="16320"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19t83jEDQja15KYS3SqcO2z" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 Cancel-Lock: sha1:gj3xeiLsPwdx+EyaVuYaj1mT2p0= In-Reply-To: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com> Content-Language: fr Xref: reader02.eternal-september.org comp.lang.ada:61862 List-Id: Le 20/04/2021 à 17:10, Vincent Marciante a écrit : > I think that I used to know this but currently am not sure: > > Assuming the a value is passed by reference, is 'Address of a parameter > always the address of the object that is passed as in: > > ... > > type Big_Record is ... > > Object : Big_Record; > > procedure Proc (Param : in out Big_Record) is > begin > if Param'Address /= Object'Address then > raise Constraint_Error; > end if; > end; > > begin > Proc(Object); > ... > As usual, the real question is "why do you need that?" If you want to check whether a parameter IS a certain variable, use Param'Has_Same_Storage(Object). If you want to check whether variables have a part in common, use Param'Overlaps_Storage (Object). See 13.3 (73.1/3 .. 73.10/3) -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52 https://www.adalog.fr