comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Normalizing array indices
Date: Wed, 02 Nov 2011 08:14:00 -0400
Date: 2011-11-02T08:14:00-04:00	[thread overview]
Message-ID: <wccfwi6zppz.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: m2mxckp3q1.fsf@pushface.org

Simon Wright <simon@pushface.org> writes:

> 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.

Yes.  It's usually a bad idea to declare an unconstrained array
(T range <>) where T'First = T'Base'First, because then empty
arrays don't work well.

E.g., "array (Enum_Type) ..." is OK, but "array (Enum_Type range <>) ..."
is probably wrong.

- Bob



      parent reply	other threads:[~2011-11-02 12:14 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
2011-11-02 12:14   ` Robert A Duff [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox