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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,147f221051e5a63d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!postnews.google.com!j33g2000pri.googlegroups.com!not-for-mail From: "jhc0033@gmail.com" Newsgroups: comp.lang.ada Subject: Re: memory management in Ada: tedious without GC? Date: Fri, 16 May 2008 22:24:16 -0700 (PDT) Organization: http://groups.google.com Message-ID: <4fe63edf-d3be-4662-ab61-d2753063d261@j33g2000pri.googlegroups.com> References: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> <9f2c2db4-d6c1-4cdf-884c-5cbc26ac7701@d1g2000hsg.googlegroups.com> <482e11c6$0$11203$4d3efbfe@news.sover.net> NNTP-Posting-Host: 75.26.46.184 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1211001856 18707 127.0.0.1 (17 May 2008 05:24:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 17 May 2008 05:24:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j33g2000pri.googlegroups.com; posting-host=75.26.46.184; posting-account=ZDEUcwoAAAAfEl68GET6fODebgE-CIe2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:139 Date: 2008-05-16T22:24:16-07:00 List-Id: On May 16, 3:59 pm, "Peter C. Chapin" wrote: > Maciej Sobczak wrote: > > In Ada RAII is realized with controlled types. > > Controlled types in Ada are great, but I think C++ has a bit of an edge > in this area (not considering the issue of the type hierarchy). In Ada, > the compiler calls Adjust after it has finalized the object on the left > side of an assignment. In C++ operator=() has access to both sides of > the assignment at once. In my opinion, the easiest and least error-prone approach to exception safety in C++ is to design your code in such a way that you can use compiler-generated copy-constructors, assignment and destructors. Incidentally, does Ada provide the programmer with automatic (and overridabe) deep-copy assignment or copy-constructor?