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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1f8b4cce7e72b123 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-26 16:32:38 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3BD9F28F.5AB29716@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Arrays and Access types... References: <20011025214647.2788a60b.egm2@jps.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 26 Oct 2001 23:32:38 GMT NNTP-Posting-Host: 63.180.2.44 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1004139158 63.180.2.44 (Fri, 26 Oct 2001 16:32:38 PDT) NNTP-Posting-Date: Fri, 26 Oct 2001 16:32:38 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Fri, 26 Oct 2001 16:28:47 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:15285 Date: 2001-10-26T23:32:38+00:00 List-Id: "Eric G. Miller" wrote: > > New to Ada and trying to figure out how to deal with arbitrary > slices of arrays. I defined an array type and an access type > for it, but I can't seem to figure out how to take a slice of > the array and assign that slice to an access type. > > Type is like: > > type My_Array is array (Positive range <>) of Integer; > type My_Array_Ref is access My_Array; > > ... in body ... > > left, right, start : My_Array_Ref; > > begin > start := new My_Array (1 .. 200); > left := start(start'first .. 100); -- that doesn't work! I doubt that you really need access types/values at all. Since all the other responses seem to be overkill, I would suggest something like Start : My_Array (1 .. 200); ... begin declare Left : [constant] My_Array := Start (Start'First .. 100); begin ... -- Jeff Carter "I wave my private parts at your aunties." Monty Python & the Holy Grail