From: Rob Solomon <usenet@drrob1-noreply.com>
Subject: Re: Table of pointers question
Date: Sat, 26 Sep 2009 14:58:53 -0400
Date: 2009-09-26T14:58:53-04:00 [thread overview]
Message-ID: <1sosb512d16k6em9e6j64isjnnb2gmn20o@4ax.com> (raw)
In-Reply-To: 3YSdnY7SXPNd_yPXnZ2dnUVZ_sydnZ2d@earthlink.com
On Sat, 26 Sep 2009 11:51:48 -0700, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
>On Sat, 26 Sep 2009 09:36:26 -0400, Rob Solomon
><usenet@drrob1-noreply.com> declaimed the following in comp.lang.ada:
>
>
>> When I did the same routine in Modula-2, I structured it the same
>> way, only used an array of pointer rather than indices. AFAIK,
>> Modula-2 does not have the capability to place data in the heap and
>> return a pointer in one assignment.
>>
> Based on the example at http://www.modula2.org/tutor/chapter11.php,
>no... They use ALLOCATE() to create one structure on the heap,
>specifying the size (apparently Modula-2 either doesn't have the
>intelligence to infer the data size, of they also use it to create
>dynamic arrays of smaller components); followed by assigning values to
>the allocated memory.
>
> In Ada, "new" is the keyword that allocates memory... There is no
>equivalent "free" as, in the realm Ada was originally spec'd for,
>garbage collection operations would have been detrimental. There is a
>generic "unchecked_deallocation" procedure -- as the name should
>indicate, usage is really up to the programmer to ensure they aren't
>leaving dangling references, etc.
>
> Note that, as with Pascal, Modula-2 requires the user to explicitly
>code pointer dereference operations. Ada rarely needs such as one can
>not perform arithmetic on access types.
I could have been clearer as to my meaning. ALLOCATE creates a
pointer to an empty object. A separate assignment statement is
required to add the data. That is, Modula-2 needs 2 statements to
achieve what Ada is allowing in that one statement.
This contraction confused me.
If I come across any embedded assignment statements in this Ada book,
like is allowed in C, I'll give up.
next prev parent reply other threads:[~2009-09-26 18:58 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
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 [this message]
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