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: 103376,eca91508b02e7e97 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sat, 16 Jun 2007 00:03:23 +0200 From: Georg Bauhaus Organization: # User-Agent: Thunderbird 1.5.0.12 (Macintosh/20070509) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Amount of copying on returned constant objects References: <5dfsfnF1qav8bU1@mid.individual.net> In-Reply-To: <5dfsfnF1qav8bU1@mid.individual.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <46730bf5$0$23134$9b4e6d93@newsspool1.arcor-online.net> NNTP-Posting-Date: 16 Jun 2007 00:00:21 CEST NNTP-Posting-Host: ad6dea1b.newsspool1.arcor-online.net X-Trace: DXC=kKeP\2oUHkA^B]`=U:WelBic==]BZ:afN4Fo<]lROoRAFl8W>\BH3YBWkPUn@1g4BGA:ho7QcPOVCZol8ABJgH?EJfi0[JoLgVE X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:16201 Date: 2007-06-16T00:00:21+02:00 List-Id: Alex R. Mosteo wrote: > > > I wonder however about results of functions, that are not modified. > > ... In C++ I could use constant references. Now, I wonder if > > a) is there something in the ARM that prevents an equivalent transparent > optimization in the Ada side (returning the reference when it is detected > that the returned object is not modified)? OTOH, I might want a constant copy because the object in the container is going to be modified... Can a compiler detect this? -- Georg