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: a07f3367d7,7b6305d0d57a9f34 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.204.148.84 with SMTP id o20mr170921bkv.6.1320181219781; Tue, 01 Nov 2011 14:00:19 -0700 (PDT) Path: l23ni45730bkv.0!nntp.google.com!news2.google.com!news.glorb.com!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.uni-weimar.de!not-for-mail From: stefan-lucks@see-the.signature Newsgroups: comp.lang.ada Subject: Re: Normalizing array indices Date: Tue, 1 Nov 2011 21:55:56 +0100 Organization: Bauhaus-Universitaet Weimar Message-ID: References: Reply-To: stefan-lucks@see-the.signature NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 X-Trace: tigger.scc.uni-weimar.de 1320181134 8163 141.54.178.228 (1 Nov 2011 20:58:54 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Tue, 1 Nov 2011 20:58:54 +0000 (UTC) X-X-Sender: lucks@medsec1.medien.uni-weimar.de In-Reply-To: Xref: news2.google.com comp.lang.ada:14270 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: 2011-11-01T21:55:56+01:00 List-Id: On Sat, 29 Oct 2011, Simon Wright wrote: > Stefan.Lucks@uni-weimar.de writes: > > But your problem was with A'Last, surely? Yes. Especially, since I initially forgot about a test case with A'Last = Positive'Last. > 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. That is the same ugly situation. Except that when you initialize an array by a constant (as in your code example above), A'First *is* the first element in the given range, i.e., Integer'First (in your case). In fact, without extra precautions (such as A: Arr(X .. X+2) := (1.0, 2.0, 3.0);), you may easily end up with a set of test cases where all have the property of A'First being Integer'First. This is very different for A'Last! Stefan -- ---- Stefan.Lucks (at) uni-weimar.de, University of Weimar, Germany ---- ------ I love the taste of Cryptanalysis in the morning! ------