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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Does object renaming allow the view to be a copy? Date: Sun, 22 Jan 2017 09:27:44 +0100 Organization: A noiseless patient Spider Message-ID: Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 22 Jan 2017 08:26:06 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b3d9c19c056cf9ad1beeec12965538a6"; logging-data="24980"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WzBlaBk3r1xXjhR3UPk/j7LV1SN1m0hg=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 X-Mozilla-News-Host: news://news.arcor.de:119 Cancel-Lock: sha1:SKaQ4uIfCA1TzTtdT33MsfeyM7s= Xref: news.eternal-september.org comp.lang.ada:33115 Date: 2017-01-22T09:27:44+01:00 List-Id: A SO answer (41746244) has given rise to the question of whether or not a compiler implementer may make a renamed object a copy of the original. (Layman's assumptions from LRM 3.1(7), 8.5.1), So, is the following program, modifying compoments of and array, ever allowed to raise Renaming_Is_Copying? with System; procedure Renaming is Renaming_Is_Copying : exception; type R is record A, B : Integer; end record; type List is array (Natural range <>) of R; Stuff : List := (10 .. 20 => R'(A => 2, B => 3)); begin for K in Stuff'Range loop declare -- -- Does Ada allow a compiler to make X be a copy? -- X : R renames Stuff (K); use type System.Address; begin if X'Address = Stuff (K)'Address then X.A := X.B; else raise Renaming_Is_Copying; end if; end; end loop; end Renaming; -- "HOTDOGS ARE NOT BOOKMARKS" Springfield Elementary teaching staff