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,HEADER_SPAM 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 17:40:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.cse.psu.edu!uwm.edu!rpi!not-for-mail From: jimmaureenrogers@worldnet.att.net (Jim Rogers) Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 19 Jun 2003 20:42:38 -0400 Organization: http://groups.google.com/ Sender: cppmods@netlab.cs.rpi.edu Message-ID: <82347202.0306191147.11374726@posting.google.com> References: <1054751321.434656@master.nyc.kbcfp.com> <7gBHa.12174$KF1.273806@amstwist00> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: 19 Jun 2003 12:47:41 -0700 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPvJYekHMCo9UcraBAQGUvgH/b5IABSG1NEvUCvZ8nnwVhkfBleZlKVal wJwsc6V2KpGuc6cpLzl/pOv/Dxo5v3W8aIisU2H/dThuq/55weJ4mg== =muxY Xref: archiver1.google.com comp.lang.ada:39467 comp.lang.c++.moderated:68763 Date: 2003-06-19T20:42:38-04:00 List-Id: kanze@gabi-soft.fr wrote in message news:... > James Rogers wrote in message > news:... > If I understand you > correctly, in Ada, the programmer is never concerned with assignment, as > defined in C++: the compiler generated assignment operator generates > code to use initialization and finalization. This is true. In Ada assignment is designated to be an operation, not an operator. There is no way to simply overrride the assignment operator. Ada controlled types provide the ability to override finalization, as has been stated before. They also allow the programmer to overrride initialization and "adjustment". Overriding adjustment and initialization provides some of the capabilities of overriding assignment in C++. The "adjustment" procedure is used for such things as incrementing reference counts. The "finalize" procedure could be used to decrement reference counts and deallocate an object when its reference count is 0. The basic logic of assignment is unchanged by overriding initialization, adjustment, and finalization. The specific order of operations is unchanged. Ada controlled types simply provide fine grained control over well defined steps in assignment. Of course, initialization is also called whenever a controlled object is created. Finalization is called whenever a controlled object goes out of scope. Jim Rogers [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]