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,2ac407a2a34565a9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.129.169 with SMTP id nx9mr6008253pbb.2.1330610603307; Thu, 01 Mar 2012 06:03:23 -0800 (PST) Path: h9ni26878pbe.0!nntp.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Thu, 01 Mar 2012 09:03:22 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> <17412419.40.1330534213855.JavaMail.geo-discussion-forums@vbva11> <87mx80x03h.fsf@ludovic-brenta.org> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1330610602 6851 192.74.137.71 (1 Mar 2012 14:03:22 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 1 Mar 2012 14:03:22 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:QV/MsDKvJHpBZDW+twIVpISvJv8= Content-Type: text/plain; charset=us-ascii Date: 2012-03-01T09:03:22-05:00 List-Id: Ludovic Brenta writes: > Robert A Duff writes on comp.lang.ada: >> Foo (Slide(A (3 .. 8))); > > Doesn't that involve copy-in and copy-out between the slice and a > temporary object of type Slide? Grossly inefficient, methinks. No, I don't see any need for the compiler to make a copy here. It just needs to pass the 1..6 bounds, plus a pointer to the array elements. I'm too lazy to check the machine code to see whether GNAT makes a copy, but I don't see why it would. Nor any other Ada compiler. - Bob