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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e52f7c34095c85e5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!newsfeed1.ip.tiscali.net!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Re: unconstrained array type problems References: From: Ludovic Brenta Date: Wed, 21 Jul 2004 17:09:06 +0200 Message-ID: <87zn5tl7n1.fsf@insalien.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:4RqdJyO3ozxJx3H2skYrYDEFud8= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tiscali bv NNTP-Posting-Date: 21 Jul 2004 17:08:12 CEST NNTP-Posting-Host: 83.134.237.146 X-Trace: 1090422492 dreader2.news.tiscali.nl 62386 83.134.237.146:32803 X-Complaints-To: abuse@tiscali.nl Xref: g2news1.google.com comp.lang.ada:2320 Date: 2004-07-21T17:08:12+02:00 List-Id: "zork" writes: > procedure Matrix is > > type Matrix_Type is array ( Integer range <>, Integer range <> ) of > Float; > .. > .. > begin > .. > Get ( File, number_rows ); -- read the number of rows from file > Get ( File, number_columns ); -- read the number of columns from file > array1 : Matrix_Type ( 1 .. number_rows, 1 .. number_columns ); > .. > end Matrix; > ------------------ > > I cant seem to define my array1 in the begin / end block. This is a bit > frustrating. How does one get around this? Is an unconstrained array the > best choice? > > Any help most appreciated! You can do it with a declare block: begin Get (File, number_rows); Get (File, number_columns); declare array1: Matrix_Type (1 .. number_rows, 1 .. number_columns); begin -- process array1 end; end; But if your processing is long, consider changing the declare block to a subprogram, and passing number_columns and number_rows to it. -- Ludovic Brenta.