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,7b6305d0d57a9f34 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.19.161 with SMTP id g1mr5543419pbe.7.1319879143564; Sat, 29 Oct 2011 02:05:43 -0700 (PDT) Path: p6ni21469pbn.0!nntp.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Normalizing array indices Date: Sat, 29 Oct 2011 10:05:42 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="4537"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7mUjs6qamcw4e2xA5hghVQdii5lnMH8I=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:lFsDA6JSQvbnDyeMx0iQgreR10g= sha1:xIl+KEWY/86wmouUKPXHZKbpcCE= Xref: news1.google.com comp.lang.ada:18743 Content-Type: text/plain; charset=us-ascii Date: 2011-10-29T10:05:42+01:00 List-Id: Stefan.Lucks@uni-weimar.de writes: > In many cases, array ranges starting with an arbitrary index are > better (higher level) to model an application's demands. But > sometimes, like when applying a sorting routine, this extra > information is actually some ballast. > > Ideally, the specification of a subprogram would carry the information > that the subprogram only uses "normalized" array indices, to free the > tester from having to consider test cases with different A'First: > > procedure Sort(A: in out Sort_Array_Type(1 .. <>)); > > The user can still call Sort with any array of range, say, 4711 .. 9421, > but Sort coldn't tell that apart from an array of range 1 .. 4711. Thus, > there is no reason for additional test cases with different values > for A'First. But your problem was with A'Last, surely? I've had more surprises with type Arr is array (Integer range <>) of Float; A : Arr := (1.0, 2.0, 3.0); where A'First is Integer'First (on GNAT), ie -2**31.