From: dweller@dfw.net (David Weller)
Subject: Unconstrained array aggregation..sq. peg into round hole?
Date: 1996/03/17
Date: 1996-03-17T00:00:00+00:00 [thread overview]
Message-ID: <4ihrvo$hs5@dfw.dfw.net> (raw)
Disclaimer: I didn't write this code, but I'm sure puzzled about what
to do to get the "desired" results. This is easy to do in C, so I'm
sure there's a "simple" way to do it in Ada 95. Anyway, the problem
is wanting to take a "slice" of a 2-dim unconstrained array and use it
to generate a constant 1-dim array. The GNAT error message is
"strange.ads:20:50: incorrect number of indices in indexed component",
but I don't see this as a GNAT bug at all.
I must confess I don't use such strange constnat initializations
typically, so I'm a little rusty on figuring out a solution.
Suggestions are welcome...
package Strange is
type Real_Array is array (Natural range <>) of Float;
type Real_Table is array (Natural range <>, Natural range <>) of Float;
MAX : constant := 3;
Table : constant Real_Table :=
( (20.0, 40.0, 80.0),
(20.0, 40.0, 80.0),
(20.0, 40.0, 80.0),
(20.0, 40.0, 80.0),
(60.0, 120.0, 240.0) );
An_Array : constant Real_Array;
private
An_Array : constant Real_Array := (0..Max-1 => Table(Max)(0..Max-1));
-- incorrect # of indices?
end Strange;
--
GNAT = GNAT is Not an Ada Translator
==Ada 95 Booch Components: www.ocsystems.com/booch or www.dfw.net/~dweller==
Reality: Work, Work, Work, Guitar. | Plugged: Fender Telecaster Deluxe
Fantasy: Guitar, Guitar, Guitar, Work(ha!) | Unplugged: Yamaha CG-150SA
next reply other threads:[~1996-03-17 0:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-03-17 0:00 David Weller [this message]
1996-03-19 0:00 ` Unconstrained array aggregation..sq. peg into round hole? Ted Dennison
1996-03-19 0:00 ` Robert Dewar
1996-03-19 0:00 ` Unconstrained array aggregation..sq. peg i John Hutchison x2141
1996-03-20 0:00 ` Unconstrained array aggregation..sq. peg into round hole? Robert I. Eachus
1996-03-20 0:00 ` Robert A Duff
1996-03-20 0:00 ` Keith Thompson
1996-03-21 0:00 ` Robert I. Eachus
1996-03-22 0:00 ` Robert Dewar
1996-03-25 0:00 ` Robert I. Eachus
1996-03-25 0:00 ` Robert Dewar
1996-03-20 0:00 ` Jon S Anthony
1996-03-20 0:00 ` David Weller
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox