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: a07f3367d7,15480fcd593513b9 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!newsfeed2.telusplanet.net!newsfeed.telus.net!news-in-02.newsfeed.easynews.com!easynews!core-easynews-01!easynews.com!en-nntp-01.dc1.easynews.com.POSTED!not-for-mail From: Rob Solomon Newsgroups: comp.lang.ada Subject: Re: Table of pointers question Message-ID: References: X-Newsreader: Forte Agent 4.2/32.1118 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@easynews.com Organization: Forte Inc. http://www.forteinc.com/apn/ X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. Date: Sat, 26 Sep 2009 09:50:05 -0400 Xref: g2news2.google.com comp.lang.ada:8481 Date: 2009-09-26T09:50:05-04:00 List-Id: >Rob Solomon writes: > >> EntryList : array (1..MaxEntries) of DirectoryEntryType; >> EntryPointerList : array (1..MaxEntries) of DirectoryEntryPointerType; > >> My question is that I would expect to have an array that contains the >> data, > >That might appear to be EntryList. Except that EntryList is never used >in the code you quoted. I don't have the book handy, so I don't know >if it is used elsewhere. > >> and a second array that is an array of pointers to the 1st array. > >That's EntryPointerList. However, the pointers simply point to >allocated memory, not to elements of EntryList or any other data >structure. > >Why did you expect pointers into an array? > >> The example does not define that. >> >> How does the line: >> EntryPointerList(NumberOfEntries) := new DirectoryEntryType'(NewEntry) >> ; >> >> Do what's needed? > >This allocates memory for the data contained in NewEntry, and stores a >pointer to it in EntryPointerList. > >The rest of the code then moves these pointers around in >EntryPointerList. > >What other languages are you familiar with? Perhaps we could relate >this Ada code to one of them. I am very familiar with Wirth languages. I have been using Modula-2 since the 80's. Some of my confusion can be due to the fact that I am merely a recreational programmer that programs for his own use and amusement.