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!news3.google.com!feeder.news-service.com!feeder.erje.net!news.tornevall.net!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Table of pointers question Date: Wed, 23 Sep 2009 20:46:28 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: NNTP-Posting-Host: 01f628b50ffb4ef007f94503e4cdd44d Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 9856613ff6ba927481a8aaf26f27b3ab X-Complaints-To: abuse@tornevall.net X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-Validate-Post: http://news.tornevall.net/validate.php?trace=9856613ff6ba927481a8aaf26f27b3ab X-SpeedUI: 1738 X-Complaints-Italiano: Parlo la lingua non � italiano User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) X-Posting-User: 9b22bfe2855937f9b3faeec7cfc91295 Xref: g2news2.google.com comp.lang.ada:8449 Date: 2009-09-23T20:46:28-07:00 List-Id: Rob Solomon wrote: > > It is a simple sorting routine that swaps pointers rather than the > data. Note that the variables are more like Modula-2 syntax as I am > very comfortable with that. And it is easier to type. From the ARM (Introduction/Design Goals): "The need for languages that promote reliability and simplify maintenance is well established. Hence emphasis was placed on program readability over ease of writing." This is one of the "three overriding concerns" in the design of Ada; if "easierToType" is more important to you than ease of reading, then Ada is probably not for you. > 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. Why would you expect that? When using pointers, the data is usually on the heap, as it is in your example. Sometimes, in cases like this, one has an array of data and an array of indices into that array, and one sorts the array of indices rather than the array of data. An index is essentially a pointer into the array. Perhaps that is what you were thinking of. -- Jeff Carter "Go and boil your bottoms." Monty Python & the Holy Grail 01