comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: 'address on a subprogram parameter
Date: Tue, 20 Apr 2021 18:35:01 +0200	[thread overview]
Message-ID: <s5mvrp$fu0$1@dont-email.me> (raw)
In-Reply-To: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>

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

  parent reply	other threads:[~2021-04-20 16:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 15:10 'address on a subprogram parameter Vincent Marciante
2021-04-20 15:52 ` AdaMagica
2021-04-20 17:32   ` Jeffrey R. Carter
2021-04-21  9:19     ` AdaMagica
2021-04-20 17:33   ` Niklas Holsti
2021-04-20 16:35 ` J-P. Rosen [this message]
2021-04-20 17:18   ` Vincent Marciante
2021-04-20 19:25     ` Randy Brukardt
2021-04-20 19:41       ` Vincent Marciante
2021-04-24  1:25         ` Randy Brukardt
2021-04-24  9:56           ` Niklas Holsti
2021-04-21 20:17     ` Shark8
2021-04-22  9:54       ` Vincent Marciante
replies disabled

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