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.1 required=5.0 tests=BAYES_05,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,177ff20edf7f64cf,start X-Google-Attributes: gid103376,public From: dweller@dfw.net (David Weller) Subject: Unconstrained array aggregation..sq. peg into round hole? Date: 1996/03/17 Message-ID: <4ihrvo$hs5@dfw.dfw.net>#1/1 X-Deja-AN: 143809988 organization: DFWNet -- Public Internet Access newsgroups: comp.lang.ada Date: 1996-03-17T00:00:00+00:00 List-Id: 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