git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Erik Faye-Lund <kusmabite@gmail.com>
Cc: David Gould <david@optimisefitness.com>, git@vger.kernel.org
Subject: Re: Probable bug in file run-command.c function clear_child_for_cleanup
Date: Mon, 10 Sep 2012 10:10:27 -0400	[thread overview]
Message-ID: <20120910141027.GA8284@sigill.intra.peff.net> (raw)
In-Reply-To: <CABPQNSaufY9vUAFp9VL2i=6bNmO5_2+anzX6+omfq+UgP03kXg@mail.gmail.com>

On Mon, Sep 10, 2012 at 03:58:40PM +0200, Erik Faye-Lund wrote:

> >> for (... {
> >>       if (... {
> >>               ...
> >>       }
> >>       last = &p->next;
> >> }
> [...]
> I feel like bikeshedding a bit today!
> 
> I tend to either prefer either the latter or something like this:
> 
> while (p) {
> 	...
> 
> 	last = p;
> 	p = p->next;
> }
> 
> because those approaches put all the iteration logic in the same
> place. The in-body traversal approach is a bit more explicit about the
> traversal details.

Also fine by me.

> And to conclude my bikeshedding for the day: Shouldn't "last" ideally
> be called something like "prev" instead? It's the previously visited
> element, not the last element in the list.

It is the "last" element visited (just as "last week" is not the end of
the world), but yes, it is ambiguous, and "prev" is not. Either is fine
by me.

-Peff

  reply	other threads:[~2012-09-10 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-09 14:44 Probable bug in file run-command.c function clear_child_for_cleanup David Gould
2012-09-10 13:44 ` Jeff King
2012-09-10 13:58   ` Erik Faye-Lund
2012-09-10 14:10     ` Jeff King [this message]
2012-09-10 20:00       ` Junio C Hamano
2012-09-10 20:01         ` Jeff King
2012-09-10 20:12           ` Junio C Hamano
2012-09-11  8:40             ` David Gould

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=20120910141027.GA8284@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=david@optimisefitness.com \
    --cc=git@vger.kernel.org \
    --cc=kusmabite@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).