comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent Marciante <vincent.marciante@l3harris.com>
Subject: Re: 'address on a subprogram parameter
Date: Tue, 20 Apr 2021 10:18:23 -0700 (PDT)	[thread overview]
Message-ID: <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com> (raw)
In-Reply-To: <s5mvrp$fu0$1@dont-email.me>

On Tuesday, April 20, 2021 at 12:35:07 PM UTC-4, J-P. Rosen wrote:
> 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

I actually do not want to test that: I just wrote that as an attempt to
make explicit want I was asking and what I did not expect (exception).
I am really working with old code where I am moving some logic out 
from within a package body that contains the "address'd" variable to
an unassociated package that defines the "Big_Record" type and I
wanted to be sure that passing it as a parameter would (always) have
the same behavior with the variable being passed as a parameter.
 

  reply	other threads:[~2021-04-20 17:18 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
2021-04-20 17:18   ` Vincent Marciante [this message]
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