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,bf03d731a6ef511f X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Copying rows in a two dimensional array. Date: Mon, 1 Feb 2010 18:07:20 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <4b6637a1$0$4586$4d3efbfe@news.sover.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1265069241 25840 69.95.181.76 (2 Feb 2010 00:07:21 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 2 Feb 2010 00:07:21 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news1.google.com comp.lang.ada:8850 Date: 2010-02-01T18:07:20-06:00 List-Id: I presume this was because the elements in question are not necessarily adjacent. As such the code ends up being exactly the same (or sometimes worse) than an explicitly coded loop. And honestly, I don't see any real advantage to slices in terms of safety (given that indexes are checked for in-range, as they are in Ada). I make just as many mistakes with slices as I do with loops -- I find it hard to figure out the ends of the two slices for assignment (which have to be the same length - mine only are about 1/2 of the time); it's about the same difficulty as figuring out the offset amount when writing a loop to copy items. So I see it as a wash, other than that a one-dimensional slice can generate much better code (using a direct memory-memory move the for entire amount). The safety win comes for whole object assignments, not parts. Randy. "Jerry" wrote in message news:ed36036c-8318-4f27-aaae-5329a8bfc83d@t31g2000prh.googlegroups.com... > I've never understood why Ada does not allow slicing in > multidimensional arrays. What are the safety issues involved? And how > is it safe to force the programmer into ad hoc methods? > > Jerry