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 From: "zork" Newsgroups: comp.lang.ada References: <87zn5tl7n1.fsf@insalien.org> Subject: Re: unconstrained array type problems Date: Thu, 22 Jul 2004 01:33:34 +1000 Organization: - X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 220.245.100.34 X-Original-NNTP-Posting-Host: 220.245.100.34 Message-ID: <40fe8ce1@dnews.tpgi.com.au> X-Trace: dnews.tpgi.com.au!tpg.com.au 1090424033 220.245.100.34 (22 Jul 2004 01:33:53 +1000) Path: g2news1.google.com!news1.google.com!news.glorb.com!solnet.ch!solnet.ch!nntp.gblx.net!nntp3.phx1!dnews.tpgi.com.au!tpg.com.au!not-for-mail Xref: g2news1.google.com comp.lang.ada:2322 Date: 2004-07-22T01:33:34+10:00 List-Id: Hi thanks for that! Yes that works for one array (just tried it) thanks!. What i forgot to mention was that i need to read in a number of arrays from the text file, and perform various operations between the arrays (multiplication). If i define a 'declare' then each matrix will only be visible to itself ( i.e. wont be visible to one another), hence the following wont work? begin Get (File, number_rows); Get (File, number_columns); declare array1: Matrix_Type (1 .. number_rows, 1 .. number_columns); begin -- read in array1 end; Get (File, number_rows); Get (File, number_columns); declare array2: Matrix_Type (1 .. number_rows, 1 .. number_columns); begin -- read in array2 end; -- multiply array1 by array2 (array multiplication) end; How can i make them visible to one another? This is so easy to do in c++/java. ADD so tight. Thanks again! zork "Ludovic Brenta" wrote in message news:87zn5tl7n1.fsf@insalien.org... > "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.