comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Passing the same actual as both in and out formal parameters?
Date: Tue, 17 Nov 2009 15:25:13 -0600
Date: 2009-11-17T15:25:13-06:00	[thread overview]
Message-ID: <hdv4br$dme$1@munin.nbi.dk> (raw)
In-Reply-To: 7dde1f20-1b53-4ccf-8344-a60c9f500130@s21g2000prm.googlegroups.com

"Adam Beneschan" <adam@irvine.com> wrote in message 
news:7dde1f20-1b53-4ccf-8344-a60c9f500130@s21g2000prm.googlegroups.com...
...
> As the others have pointed out, the answers to your questions are
> "yes", changing B.L does change A.L if the same object is passed as a
> parameter to both A and B.  The semantics are well-defined.  My
> concern would be whether optimization could change the order of the
> operations inside P in a way that affects the results if A and B are
> aliases for the same object; I don't know offhand whether this is
> allowable for parameters of by-reference types.  I'd have to hunt
> through the RM to figure this out, unless someone already knows the
> answer.

I don't believe such an optimization would be legitimate, but given how hard 
it is to understand 11.6, I could be wrong. Most of the permissions to 
optimize are related to whether (and where) exceptions are raised, but there 
is no exception here. Similarly, there are a lot of things that are 
evaluated in an unspecified order (which could change because of 
optimization), but that also does not apply here.

> I think AI05-191 is related to this.  Offhand, it appears that if this
> AI is addressed, you could put an assertion somewhere (as a
> precondition of P, if AI05-145 is addressed) to ensure that P is never
> called with aliased (or overlapping) components, if that would be bad.

Right, that's my understanding of the point. The only problem is, there 
isn't any sane way to describe such an assertion.


                                Randy.

P.S. The checks proposed in AI05-0144-1 also are related to this situation, 
although they would not detect this particular case (as the semantics is 
well-defined, there is no non-portability here).





  reply	other threads:[~2009-11-17 21:25 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
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 [this message]
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