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.2 required=5.0 tests=BAYES_00,HEADER_SPAM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-ArrivalTime: 2003-06-19 01:27:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.edu!rpi!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Followup-To: comp.lang.ada Date: 19 Jun 2003 04:30:12 -0400 Organization: At home Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: <1054751321.434656@master.nyc.kbcfp.com> <7gBHa.12174$KF1.273806@amstwist00> <7RQHa.3141$Uh2.339@nwrdny01.gnilink.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Thu, 19 Jun 2003 09:06:32 +0200 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPvF0kEHMCo9UcraBAQHa8wH+Kjn7X9vhnkQMZhE1pDq5Svt+fPkjk91D isgtHOHOfOZHKcCMy6e1jvnWVnuMZpBQITbWGbSJH4TgFHs7mrYgbg== =VRZO Xref: archiver1.google.com comp.lang.ada:39433 comp.lang.c++.moderated:68713 Date: 2003-06-19T04:30:12-04:00 List-Id: Hyman Rosen wrote: > Wesley Groleau wrote: >> That's what's nice about Ada controlled types. >> You can use them for anything with mandatory finalization, >> not just GC. I suppose C++ destructors could do the same. > > Of course, and much more easily, since C++ destructors do not > require inheritance from a special class like Ada's controlled > types, They do require "inheritance". That special controlled type is called "class" in C++. You cannot have a destructor for, say, "char *" (you cannot even derive from it). So there is practically no difference between Ada and C++ with this respect. > and classes with destructors can be declared in any > scope, not just at library level. Yes, this is an important difference. Sometimes (not often) it becomes painful. However, for years, C++ lives with only "library-level" subroutines. There is another difference. The parent destructors are called automatically. This is the single case, I know, where C++ is safer than Ada, and Ada is more "flexible" than C++. (:-)) -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]