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 Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Table of pointers question References: <3cadnZif2YjGbyfXnZ2dnUVZ_tmdnZ2d@earthlink.com> From: Stephen Leake Date: Sun, 27 Sep 2009 01:53:28 -0400 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:rb3+MXONYwYe93vrzp+vhtba7Mo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 078814abefdcfe197caa718158 Xref: g2news2.google.com comp.lang.ada:8494 Date: 2009-09-27T01:53:28-04:00 List-Id: Rob Solomon writes: >>> My question is that I would expect to have an array that contains the >>> data, and a second array that is an array of pointers to the 1st >>> array. The example does not define that. >> >> That sounds like what I'd have used in BASIC or FORTRAN -- an array >>of INDICES (not [memory] pointers) used as subscripts to a static array >>of the data -- and the sort would be implemented by swapping the >>indices, not the physical data (IOWs, the indices start sorted 1..n, and >>end up out-of-order -- but when you then retrieve the data be using the >>indices from first to last, the data is in correct order). >> > You are describing how I expected the code to be written. Many years > ago I wrote that very routine in Fortran, and I felt very satisfied > that it worked. Note that you can implement that same approach in Ada. You should do that, as an excersize in learning Ada. The tradeoffs between that approach and the "pointer" approach are subtle, and not very meaningful for this simple example. -- -- Stephe