Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c Subject: Re: OOP and C++ and C Date: Thu, 03 Nov 2011 16:03:14 +1300 Lines: 24 Message-ID: <9heejiFilbU1@mid.individual.net> References: <20111021130723.160@kylheku.com> <32eda52c-9c71-40d4-bfe2-c3909945d7ae@u13g2000vbx.googlegroups.com> <42b34cc2-54a1-42c7-9df2-83a79e96fd01@hj4g2000vbb.googlegroups.com> <70cc03d0-c611-4445-905a-bdb8ca8de27b@m5g2000prg.googlegroups.com> <20111102222329.818@kylheku.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net NCAecYA8+kudjvV0ftB4mAijyffqTObrBsVVOa0VivP0SVDi6I Cancel-Lock: sha1:PEaHiY5gOYmqROPgU4q/RlJiBt8= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: <20111102222329.818@kylheku.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:12572 On 11/ 3/11 03:38 PM, Kaz Kylheku wrote: > On 2011-10-30, nroberts wrote: >> On Oct 29, 12:18 pm, Markus Wichmann wrote: >>> On 29.10.2011 08:56, Jorgen Grahn wrote: >>> >>>> So do I, and it's definitely workable -- but not having RAII, >> >> Not having scope tied destructors hurts. > > Not having scope-tied exit code ("unwind protect") is what hurts! > > This hurts even when you have destructors because destructors are > clumsy. They let you run code, but in a remote context somewhere with > its own scope which has no visibility into the scope which is > terminating (i.e. the object that actually needs the clean up). > > I would gladly trade C++ destructors for unwind protect. How would unwind-protect work in cases where you want an object's destruction to cause the release of a managed resource (a smart pointer for example)? -- Ian Collins