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!news1.google.com!news.glorb.com!newsgate.cistron.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Re: unconstrained array type problems References: <87zn5tl7n1.fsf@insalien.org> <40fe8ce1@dnews.tpgi.com.au> From: Ludovic Brenta Date: Wed, 21 Jul 2004 18:24:37 +0200 Message-ID: <87vfghl456.fsf@insalien.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:A9ypkFUCH4A/+o19ned7nDkFc7g= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tiscali bv NNTP-Posting-Date: 21 Jul 2004 18:23:43 CEST NNTP-Posting-Host: 83.134.237.146 X-Trace: 1090427023 dreader2.news.tiscali.nl 62386 83.134.237.146:32803 X-Complaints-To: abuse@tiscali.nl Xref: g2news1.google.com comp.lang.ada:2324 Date: 2004-07-21T18:23:43+02:00 List-Id: Marius Amado Alves writes: >> How can i make them visible to one another? This is so easy to do in >> c++/java. > > This is extremely easy in Ada with the proper design, namely with > these two entities: > > type Matrix is array (Positive range <>, Positive range <>) of Real; > function Read_File (Name : String) return Matrix; > > Then read all the matrices you want in the same place: > > Matrix_1 : Matrix := Read_Matrix ("One"); > Matrix_2 : Matrix := Read_Matrix ("Two"); > ... Yes, this is as I suggested, move the declare block to its own subprogram. But to answer more directly to the OP's question: begin Get (File, number_rows_1); Get (File, number_columns_1); Get (File, number_rows_2); Get (File, number_columns_2); declare array1: Matrix_Type (1 .. number_rows, 1 .. number_columns); array2: Matrix_Type (1 .. number_rows, 1 .. number_columns); begin -- read in array1 -- read in array2 -- multiply array1 by array2 (array multiplication) end; end; -- Ludovic Brenta.