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,15a27badd5b09d59 X-Google-Attributes: gid103376,public From: holsti@cs.Helsinki.FI (Niklas Holsti) Subject: Re: dynamic allocation Date: 1995/04/04 Message-ID: <3lqhb3$e5h@hydra.Helsinki.FI>#1/1 X-Deja-AN: 100815544 references: <3loml4$98v@erinews.ericsson.se> organization: University of Helsinki, Department of Computer Science newsgroups: comp.lang.ada Date: 1995-04-04T00:00:00+00:00 List-Id: In <3loml4$98v@erinews.ericsson.se> ehsjony@ehs.ericsson.se (Jonas Nygren) writes: >Some short questions: >Does Ada95 have dynamic memory allocation/deallocation primitives builtin >to the language - cf. C++'s new and delete? Yes, "new" and "unchecked_deallocation". Don't be scared by the name of the latter, it's safer than the "delete" in C++. Ada 83 has these also. >Does Ada95 have functionality comparable with C++'s constructors and >destructors? Yes, default initialization and finalization for Controlled types. This is new with Ada 95. >Does Ada95 support garbage collection? Automatic garbage collection is allowed in both Ada 83 and Ada 95, but no known compilers do it. Both Ada 83 and 95 can collect the memory used by dynamically allocated objects of a type when the type goes out of scope. So if in a subprogram you define a local type, the dynamically allocated objects of that type may be collected when the subprogram returns. I think this is implementation dependent, however. Ada 95 gives you more control over the storage pools. >thanks in advance >/jonas Hope to have helped, - Niklas -- Niklas Holsti Space Systems Finland Ltd, phone +358 0 4354 3928 Tekniikantie 12, P.O. Box 324, FIN-02151 Espoo, Finland