From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,9cccd7364739aea1 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Passing the same actual as both in and out formal parameters? Date: Tue, 17 Nov 2009 15:25:13 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <1fbe454c-52b0-408b-9159-982fc019a53c@j19g2000yqk.googlegroups.com> <7dde1f20-1b53-4ccf-8344-a60c9f500130@s21g2000prm.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1258493115 14030 69.95.181.76 (17 Nov 2009 21:25:15 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 17 Nov 2009 21:25:15 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news1.google.com comp.lang.ada:8132 Date: 2009-11-17T15:25:13-06:00 List-Id: "Adam Beneschan" 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).