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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d0728b52f51f685e X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!prodigy.com!atl-c02.usenetserver.com!news.usenetserver.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 25 May 2004 16:50:02 -0500 Date: Tue, 25 May 2004 17:50:01 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: copy constructor for sockets References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-FNSI52ZGeAKL5Zpc2Ue/IAC6ktb98dLAPHUV8bz9U2Zdel2AULlRZXPogC4sUIWJb1/v3+IY00yPYTT!96gnDaQVmMuPVfg7acb2sJSaJJZHsQ4qVHUu/F4BojU8ZuxGPrBc+zeonVnOlw== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: controlnews3.google.com comp.lang.ada:834 Date: 2004-05-25T17:50:01-04:00 List-Id: Simon Wright wrote: > Matthew Heaney writes: > > >>>in which of these times you should decrement, >> >>Huh? Every time, of course. How could it be otherwise? What would >>a reference counting scheme even mean, if you didn't decrement the >>refcount during finalization of the object? > > I have it stuck in my head that Finalize can get called more than > once. Which would make a mockery of (simple-minded) reference counting > schemes, of course. Please tell me it ain't so! (or explain why it's > not actually a problem ..) Yes, Finalize can be called more than once, especially when exceptions occur. The solution I usually use is to something else during the finalization, and only change the reference count if that succeeds. In a reference counting scheme you need a "finalized" flag as well as an initialized flag, which can be different values in the same byte (uninitialized, valid, finalized). -- Robert I. Eachus "The terrorists rejoice in the killing of the innocent, and have promised similar violence against Americans, against all free peoples, and against any Muslims who reject their ideology of murder. Their barbarism cannot be appeased, and their hatred cannot be satisfied. There's only one way to deal with terror: We must confront the enemy and stay on the offensive until these killers are defeated." -- George W. Bush