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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,86ec22e070e319c0 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: How do I get this to work?? Date: 1999/01/18 Message-ID: #1/1 X-Deja-AN: 433894192 Sender: matt@mheaney.ni.net References: <76s0dp$1v4$1@nntp3.uunet.ca> <76tbvv$ba5$1@nntp3.uunet.ca> <770ifd$qui$1@goblin.uunet.ca> <771bl9$sla$1@nnrp1.dejanews.com> <77b9cp$5kh$1@nnrp1.dejanews.com> NNTP-Posting-Date: Sun, 17 Jan 1999 22:16:18 PDT Newsgroups: comp.lang.ada Date: 1999-01-18T00:00:00+00:00 List-Id: warwicks@telusplanet.net (Chris Warwick) writes: > In article , Matthew Heaney wrote: > > >Although officially all Unchecked_Conversion has to do is set the > >pointer passed in to null, without actually deallocating any memory, in > >practice UC really does reclaim memory. It's just like free(). So it > >is untrue that "most Ada compilers have no way to deallocate memory." > > Of all the Ada compilers I have dealt with, both 83 and 95, none > deallocate memory to my knowledge (GNAT may, but I haven't had need to > look). Indeed this is one of the first questions I ask when I discover > c++ programmers using Ada... I don't know what you mean here. Are you saying that the compilers don't come with a garbage collector, or are you saying that when you (manually) called an instantiation of unchecked_deallocation, the memory didn't get deallocated? Except for recent compilers that target the Java VM, no known Ada compilers come with a garbage collector. All known Ada compilers really do deallocate memory when you call Unchecked_Deallocation. Please state whether you are refering to a manual invokation of Unchecked_Deallocation, or to an automatic gargage collector; and, state which specific compilers from which specific vendors you were using. Perhaps this is a just a misunderstanding about what "deallocating memory" means. > >(Because the terms "heap" and "deallocate memory" aren't formally > >specifiable, there's nothing the RM can do except specify external > >behavior, as in "set the pointer to null.") > > At the last Tri-Ada I went to there was a discussion on how to fix > this (95 allows you to define individual allocation strategies), but > the gent who was trying had given up as it was too difficult... State the exact paper that was presented, and the email address of the presenter. I will speak to him to see if we can sort out his difficulties. > >The moral of the story is that, in general, when you have a choice, > >don't manipulate references ("pointers") directly. The language > >mandates the argument passing mechanism (by val vs by ref) for types > >passed to a subprogram having a C convention, so the idea is to let the > >compiler generate the reference ("address") automatically. > > I agree with this, but I am finding it difficult to use the Object > features of Ada 95 without using pointers. This situation came up, > because the compiler I am using refuses to pass anything by value, and > I am stuck with pointers passed through the interface code. What convention are you using? The language states what the passing mechanism is for various types for language-defined conventions. Perhaps if you post a small example of code that "refuses to pass anything by value," we can analyze it to see if we can figure out what the problem is. -- Those who believe in the supernatural should be required to learn computer programming. This would force them to discover that things which appear at first to be completely mysterious and incomprehensible, in fact have a logical (and usually simple) explanation. --J.B.R. Yant