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!news2.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-03.dc1.easynews.com.POSTED!not-for-mail From: Rob Solomon Newsgroups: comp.lang.ada Subject: Re: Table of pointers question Message-ID: <1sosb512d16k6em9e6j64isjnnb2gmn20o@4ax.com> References: <3cadnZif2YjGbyfXnZ2dnUVZ_tmdnZ2d@earthlink.com> <3YSdnY7SXPNd_yPXnZ2dnUVZ_sydnZ2d@earthlink.com> 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 14:58:53 -0400 Xref: g2news2.google.com comp.lang.ada:8487 Date: 2009-09-26T14:58:53-04:00 List-Id: On Sat, 26 Sep 2009 11:51:48 -0700, Dennis Lee Bieber wrote: >On Sat, 26 Sep 2009 09:36:26 -0400, Rob Solomon > 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.