comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@maps.futureapps.de>
Subject: Re: Table of pointers question
Date: Thu, 24 Sep 2009 08:59:07 +0200
Date: 2009-09-24T08:59:08+02:00	[thread overview]
Message-ID: <4abb18bc$0$30225$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <utflb5p8871f6p2531cr81tkdteacm786a@4ax.com>

Rob Solomon wrote:
> I am working my way thru Ada As A Second Language by Norman Cohen (c)
> 1996
> 
> This confuses me.
> 
> 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.

Has something gone wrong when (I'm guessing here) the
program was rewritten for Ada?  The compiler shows some
errors.  After correcting these formally, i.e. without thinking,
it confirms Adam's observation, and hints to others:

Compiling: printdirectory.adb (source file time stamp: 2009-09-24 06:42:50)

    25.   EntryList        : array (1..MaxEntries) of DirectoryEntryType;
          |
        >>> warning: variable "EntryList" is not referenced

    33.     NewEntry.NamePart := To_Bounded_String(Buffer(1..Length));
            |
        >>> warning: "NewEntry" may be null



Here, the "correction" was
1 -  END IF;  -- semicolon, not colon
...
2, 3 -    EntryPointerList(NumberOfEntries) := -- *new*
DirectoryEntry*Pointer*Type'(NewEntry);  -- MY QUESTION HERE

(NewEntry is of a pointer type already.)

Maybe the intent is that EntryList should privide storage
for new directory entries, as mentioned in other postings?
No "new" then, but putting pointers to the entries in EntryList
into EntryPointerList.  I guess that NewEntry should stand
for one of the components of EntryList during each loop.

Side note: A good source code editor will remove the burden
of having to press the shift key for capital letters:
whenever you press '_' or ' ' or ':' etc, the preceding
identifier will, by default, be adjusted to your casing
preferences.  They should be easy to type then.



  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 [this message]
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
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