From: stefan-lucks@see-the.signature
Subject: Re: Normalizing array indices
Date: Tue, 1 Nov 2011 21:55:56 +0100
Date: 2011-11-01T21:55:56+01:00 [thread overview]
Message-ID: <Pine.LNX.4.64.1111012150380.10832@medsec1.medien.uni-weimar.de> (raw)
In-Reply-To: <m2mxckp3q1.fsf@pushface.org>
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 ----
<http://www.uni-weimar.de/cms/medien/mediensicherheit/home.html>
------ I love the taste of Cryptanalysis in the morning! ------
next prev parent reply other threads:[~2011-11-01 21:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-28 18:58 Normalizing array indices Stefan.Lucks
2011-10-28 20:36 ` Adam Beneschan
2011-11-01 20:18 ` Stefan.Lucks
2011-10-28 21:13 ` Randy Brukardt
2011-10-29 7:29 ` Pascal Obry
2011-10-29 19:18 ` Jeffrey Carter
2011-10-29 19:58 ` tmoran
2011-10-29 21:15 ` Simon Wright
2011-10-29 20:41 ` Randy Brukardt
2011-11-01 20:49 ` stefan-lucks
2011-11-01 20:44 ` stefan-lucks
2011-11-01 20:43 ` stefan-lucks
2011-11-02 12:16 ` Robert A Duff
2011-10-29 9:05 ` Simon Wright
2011-10-29 9:23 ` Dmitry A. Kazakov
2011-11-01 20:55 ` stefan-lucks [this message]
2011-11-02 12:14 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox