From: Tom Tromey <tromey@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Fission patch 1/2
Date: Fri, 13 Apr 2012 18:11:00 -0000 [thread overview]
Message-ID: <87obqvwmay.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CADPb22TjLnt5y7AzvhfQ5aZvyAu+jtW07W-1TkPu5SgPPzZsHQ@mail.gmail.com> (Doug Evans's message of "Fri, 13 Apr 2012 10:23:03 -0700")
>>>>> "Doug" == Doug Evans <dje@google.com> 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
next prev parent reply other threads:[~2012-04-13 17:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 7:44 Doug Evans
2012-04-13 17:12 ` Tom Tromey
2012-04-13 17:30 ` Doug Evans
2012-04-13 18:11 ` Tom Tromey [this message]
2012-04-13 19:46 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87obqvwmay.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox