From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: Passing the same actual as both in and out formal parameters?
Date: Tue, 17 Nov 2009 11:31:02 +0100
Date: 2009-11-17T11:31:02+01:00 [thread overview]
Message-ID: <81utdh.otp.ln@hunter.axlog.fr> (raw)
In-Reply-To: <1fbe454c-52b0-408b-9159-982fc019a53c@j19g2000yqk.googlegroups.com>
Ludovic Brenta a �crit :
> procedure P (A : in T; B : out T) is
> begin
> B.L := A.M; -- does this change A.L too?
Yes
> B.M := A.L; -- bug: A.L has been clobbered, now B.M = B.L?
> end P;
>
> My concern stems from the fact that T is tagged (I cannot change
> that), so Object is passed by reference as both A and B.
>
> Am I right to be concerned?
>
Depend on what your concern is ;-)
The semantic is well defined: tagged types are by-reference type. If you
want to swap two fields of different parameters of the same type, use a
local variable.
--
---------------------------------------------------------
J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
next prev parent reply other threads:[~2009-11-17 10:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-17 9:50 Passing the same actual as both in and out formal parameters? Ludovic Brenta
2009-11-17 10:31 ` Jean-Pierre Rosen [this message]
2009-11-17 11:26 ` Ludovic Brenta
2009-11-17 13:13 ` Jean-Pierre Rosen
2009-11-17 16:07 ` Ludovic Brenta
2009-11-18 10:00 ` Jean-Pierre Rosen
2009-11-17 10:40 ` Niklas Holsti
2009-11-17 16:26 ` Adam Beneschan
2009-11-17 21:25 ` Randy Brukardt
2009-11-18 0:11 ` Jeffrey R. Carter
2009-11-18 0:23 ` Adam Beneschan
2009-11-18 3:47 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox