comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@organon.com (Jon S Anthony)
Subject: Re: Unconstrained array aggregation..sq. peg into round hole?
Date: 1996/03/20
Date: 1996-03-20T00:00:00+00:00	[thread overview]
Message-ID: <JSA.96Mar19204126@organon.com> (raw)
In-Reply-To: 4ihrvo$hs5@dfw.dfw.net

In article <4ihrvo$hs5@dfw.dfw.net> dweller@dfw.net (David Weller) writes:

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

Table is a 2 dimensional array with float components.  The error line
shows an attempt to only specify one index of the two required.  Two
dimensional arrays do not have Pascal array of array semantics.  You
have to write that if it is what you want.  Of course here, you can't
quite do that because you can't have an indefinite type be a component
of an array (the potential Real_Array part).  The typical trick is to
use an array of pointers to unconstrained array type.

see 3.6(10, 12, 13)

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178

617.484.3383
jsa@organon.com





  parent reply	other threads:[~1996-03-20  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-17  0:00 Unconstrained array aggregation..sq. peg into round hole? David Weller
1996-03-19  0:00 ` 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 ` Jon S Anthony [this message]
1996-03-20  0:00   ` Unconstrained array aggregation..sq. peg into round hole? David Weller
1996-03-20  0:00 ` 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
replies disabled

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