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: 103376,147f221051e5a63d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!34g2000hsf.googlegroups.com!not-for-mail From: Matthew Heaney Newsgroups: comp.lang.ada Subject: Re: memory management in Ada: tedious without GC? Date: Sun, 18 May 2008 20:44:18 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> NNTP-Posting-Host: 65.110.143.10 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1211168659 7980 127.0.0.1 (19 May 2008 03:44:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 19 May 2008 03:44:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 34g2000hsf.googlegroups.com; posting-host=65.110.143.10; posting-account=umyUbgkAAADe5rQC4VzV-ffCoH4N30u3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:217 Date: 2008-05-18T20:44:18-07:00 List-Id: On May 16, 1:44=A0pm, "jhc0...@gmail.com" wrote: > > To me, this seems much, much more error-prone and tedious that C++'s > RAII approach, where you almost never have to worry about deallocation > (i.e. "b" and "c" above), even in the presence of exceptions, unless > you have GC. Besides, RAII applies to a bunch of other things, like > thread locks, database connections, files - not just memory. You seem to be conflating two different things. You want information about RAII in Ada, but then ask about memory management in Ada. Stroustrup's whole point that GC only solves one part (automation memory reclaimation) of a larger problem (automation resource reclaimation). You yourself do mention this fact, but only in the very last sentence of your post! Yes, Ada has the analog of C++ ctor's and dtor's, so yes, you can do RAII in Ada. Usually it involves the use of Ada.Finalization.Controlled (and really, just the Finalize part).