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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5556ca7de188d5ef X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-11 15:07:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Multidimensional array vs. array of array Date: 11 Dec 2001 18:03:51 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1008112021 2410 128.183.220.71 (11 Dec 2001 23:07:01 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 11 Dec 2001 23:07:01 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:17795 Date: 2001-12-11T23:07:01+00:00 List-Id: lutz@iks-jena.de (Lutz Donnerhacke) writes: > How does a skilled Ada programmer define a return type containing a > multidimensional array? I suspect the answer is : you don't. Define a procedure with an 'in out' parameter instead. Or one 'in' and one 'out'. > Of course, the simple solution works: > > type Equations is array (Rows range <>, Columns range <>) of Number; > type Workspace (row : Rows; col : Columns) is record > eqs : Equations (Rows'First .. row, Columns'First .. col); > ... some more stuff ... > end record; > function Init_Workspace return Workspace; > > But this approach fails miserably on extracting a single row from the result > as well as on construction the result in a recursive function. Yes, this is a fundamental limitation. If you think about a reasonable implementaion of multi-dimensional arrays, and what you are asking the compiler to do, it will make sense that it is a limitation. -- -- Stephe