From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20929 invoked by alias); 13 Apr 2012 17:53:46 -0000 Received: (qmail 20909 invoked by uid 22791); 13 Apr 2012 17:53:43 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Apr 2012 17:53:28 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3DHrQHM026081 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Apr 2012 13:53:26 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3DHrPHv015347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 13 Apr 2012 13:53:26 -0400 From: Tom Tromey To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Fission patch 1/2 References: <20120413072548.EAA5F2461B3@ruffy.mtv.corp.google.com> <87iph3y39k.fsf@fleche.redhat.com> Date: Fri, 13 Apr 2012 18:11:00 -0000 In-Reply-To: (Doug Evans's message of "Fri, 13 Apr 2012 10:23:03 -0700") Message-ID: <87obqvwmay.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00379.txt.bz2 >>>>> "Doug" == Doug Evans writes: Doug> I wonder if to some, but not complete, extent (*1) cleanups are more Doug> fragile than necessary because the API is more fragile than necessary. Doug> My intent was the opposite, but ok, such is life. In general I think making them more dynamic is troublesome. It makes the logic of the function harder to read. I'd rather cleanups be even more static, like C++ destructors. Then in the cases where dynamic behavior is needed, it would be done locally via particular local objects, rather than manipulations of the cleanups themselves. Tom> It is better to keep a separate flag. Doug> That sounds pretty odd (and error prone). Yeah. Doug> Are there *useful* situations in which make_cleanup can return Doug> NULL? Is it only the first one? TRY_CATCH resets the cleanup chain. So, I think the first call to make_cleanup inside any TRY_CATCH will return NULL. Doug> It feels like it would be cleaner if that were never true, and Doug> thus the users needn't have a separate flag, and thus can be Doug> simpler (and thus the intuitive choice isn't the wrong thing to Doug> do). I agree this would be an improvement. Though I'd still prefer that most code not play games with cleanups at all and just treat them as block-scoped as much as possible. Tom