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!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: From: Stephen Leake Date: Thu, 24 Sep 2009 02:59:16 -0400 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:CjHt1KnU7EOR8eXDswfcJq3aqv0= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 8a2ba4abb18c6e197caa709030 Xref: g2news2.google.com comp.lang.ada:8454 Date: 2009-09-24T02:59:16-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. -- -- Stephe