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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!crdgw1!minerva!kassover From: kassover@minerva.crd.ge.com (David Kassover) Newsgroups: comp.lang.ada Subject: Re: C Strings in Ada? Message-ID: <8462@crdgw1.crd.ge.com> Date: 11 Jun 90 21:01:13 GMT References: <920024@hpclapd.HP.COM> <920025@hpclapd.HP.COM> <1304@software.software.org> <57245@bbn.BBN.COM> <8446@crdgw1.crd.ge.com> <57288@bbn.BBN.COM> Sender: news@crdgw1.crd.ge.com Organization: Aule-Tek, Inc. List-Id: In article <57288@bbn.BBN.COM> adoyle@vax.bbn.com (Allan Doyle) writes: ... >When I am using the Ada "new" keyword, I know full well that I'm creating >potential for garbage. I can control when I call it. I can write my own >memory manager around it. I don't get that control when I need a construct >like > > declare > c_string : constant string := "foo" & ascii.nul; > begin > > end; I'll ask for some clarification from the language lawyers (and others who have experience with specific Ada environments other than VAX Ada) but I don't think garbage collection in this instance was ever an issue. That is, I have used similar constructs (and rather large ones, too: potential to store 90000 g_floats) in VAX Ada. It, so far, has appeared that when the declared variables go out of scope, the memory is returned to "the system". On the other hand, stuff that is created with NEW is often intended *not* to go out of scope, so unchecked_deallocation is needed to get rid of it (presumably, *after* the program has verified that "no one else" still points to it) And furthermore, I remember having a discussion about this about a year ago, before I implemented the monster data structure (we use it to pass potentially large arrays to and from a FORTRAN program, especially in instances where it is hard for the Ada code to determine the dimensions of the array. I was assured that exhaustion of "heap space" would not be a problem, given that there was enough heap available for any one scope. But again, that may be a "feature" of VAX Ada's way of dealing with it. -- David Kassover "Proper technique helps protect you against kassover@ra.crd.ge.com sharp weapons and dull judges." kassover@crd.ge.com F. Collins