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 X-Google-Thread: 103376,dfc164e526616c68 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How to extract range from array Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1142608344.661977.123860@i39g2000cwa.googlegroups.com> Date: Mon, 20 Mar 2006 15:20:26 +0100 Message-ID: <1u0kl7a0z3apw$.1jajgn9bqfrkl.dlg@40tude.net> NNTP-Posting-Date: 20 Mar 2006 15:20:26 MET NNTP-Posting-Host: ae726828.newsread2.arcor-online.net X-Trace: DXC=j=:`ZjXDe?P>K]\3>m]<[UQ5U85hF6f;TjW\KbG]kaMXQ>n?D9BSA]\ZFm4oJHSm]Z[6LHn;2LCV^7enW;^6ZC`TIXm65S@:3>_ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3487 Date: 2006-03-20T15:20:26+01:00 List-Id: On Mon, 20 Mar 2006 14:14:37 +0100, Maciej Sobczak wrote: > subtype My_Range is Integer range My_Array'Range; > > This suggests that arrays cannot have more elements than Integer'Last. > Which cannot be true. > > What am I missing? A'Range is not a [sub]type, it is a value of some anonymous "range-type." What you need is: subtype My_Range is My_Array'Index range My_Array'Range; -- This is not Ada! alas. This is also why you cannot: generic type My_Array is array (<>) of Something; -- Not Ada! Ada does not have array interfaces. So you have to specify the index type instead of asking it from the array's instance: generic type My_Index is ...; type My_Array is array (My_Index range <>) of Something; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de