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,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!j19g2000yqk.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Passing the same actual as both in and out formal parameters? Date: Tue, 17 Nov 2009 01:50:04 -0800 (PST) Organization: http://groups.google.com Message-ID: <1fbe454c-52b0-408b-9159-982fc019a53c@j19g2000yqk.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1258451404 28843 127.0.0.1 (17 Nov 2009 09:50:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 17 Nov 2009 09:50:04 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j19g2000yqk.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8120 Date: 2009-11-17T01:50:04-08:00 List-Id: Consider: type T is tagged private; procedure P (A : in T; B : out T) is separate; Object : T; begin P (A => Object, B => Object); This seems legal but I suspect the execution might lead to bugs if P reads and writes components of A and B in arbitrary order, e.g. type T is tagged record L, M : Integer; end record; procedure P (A : in T; B : out T) is begin B.L := A.M; -- does this change A.L too? 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? -- Ludovic Brenta.