comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Table of pointers question
Date: Thu, 24 Sep 2009 02:59:16 -0400
Date: 2009-09-24T02:59:16-04:00	[thread overview]
Message-ID: <u1vlwesl7.fsf@stephe-leake.org> (raw)
In-Reply-To: utflb5p8871f6p2531cr81tkdteacm786a@4ax.com

Rob Solomon <usenet@drrob1-noreply.com> 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



  parent reply	other threads:[~2009-09-24  6:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24  0:47 Table of pointers question Rob Solomon
2009-09-24  1:34 ` Adam Beneschan
2009-09-24  6:39   ` tmoran
2009-09-25 16:52   ` björn lundin
2009-09-25 17:12     ` Adam Beneschan
2009-09-24  2:00 ` (see below)
2009-09-24  3:46 ` Jeffrey R. Carter
2009-09-24  6:59 ` Georg Bauhaus
2009-09-24  7:06   ` Georg Bauhaus
2009-09-24 14:55   ` Adam Beneschan
2009-09-26 13:45     ` Rob Solomon
2009-09-24  6:59 ` Stephen Leake [this message]
2009-09-26 13:50   ` Rob Solomon
     [not found] ` <3cadnZif2YjGbyfXnZ2dnUVZ_tmdnZ2d@earthlink.com>
2009-09-24 12:49   ` Robert A Duff
2009-09-26 13:36   ` Rob Solomon
2009-09-26 14:51     ` John B. Matthews
     [not found]     ` <3YSdnY7SXPNd_yPXnZ2dnUVZ_sydnZ2d@earthlink.com>
2009-09-26 18:58       ` Rob Solomon
2009-09-26 21:00       ` Georg Bauhaus
2009-09-27  5:53     ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox