All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russ Allbery <rra@stanford.edu>
To: git@vger.kernel.org
Subject: Re: [PATCH] diff-cache path restriction fix.
Date: Tue, 24 May 2005 19:16:20 -0700	[thread overview]
Message-ID: <87u0kscaob.fsf@windlord.stanford.edu> (raw)
In-Reply-To: <7v3bscqdlr.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Tue, 24 May 2005 18:49:20 -0700")

Junio C Hamano <junkio@cox.net> writes:

> Yes, I was trained by Paul Eggert (me says that proudly).

> Practically speaking, the only time I deliberately used > and >=
> was when I was doing some dialect of SQL that always wanted
> literal on fixed side and column on the other; I do not remember
> which was which and whose SQL anymore.

> Of course I sometimes end up using them when I am trying to
> match the style of existing code.  However, for that particular
> comparison in diff-cache, there weren't any other around there
> to match, other than the "if (argc < 2 || ...)" after the loop,
> which was what I myself wrote so it does not count.

My prior programming experience has taught me to read argv > 1 as an
assertion about argv, as opposed to 1 < argv, which would be an assertion
about 1.  In other words, as I code, I'm generally thinking about testing
a variable against some sort of boundary condition (which may or may not
be itself variable), and the thing that I'm testing goes first, followed
by the test.  As a result, 1 < argv throws me for a moment, since on first
read it seems to imply the programmer was expecting the value of 1 to
change.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

  reply	other threads:[~2005-05-25  2:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-25  0:47 [PATCH] diff-cache path restriction fix Junio C Hamano
2005-05-25  1:00 ` Linus Torvalds
2005-05-25  1:05   ` Junio C Hamano
2005-05-25  1:24     ` Linus Torvalds
2005-05-25  1:49       ` Junio C Hamano
2005-05-25  2:16         ` Russ Allbery [this message]
2005-05-25  2:33           ` Junio C Hamano
2005-05-25  3:04         ` Linus Torvalds
2005-05-25  3:22           ` Junio C Hamano
2005-05-25  9:06           ` Ingo Molnar
2005-05-25 17:07             ` Linus Torvalds
2005-05-25 19:14             ` Junio C Hamano
2005-05-25 19:17               ` Thomas Glanzmann
2005-05-25 20:31             ` Matthias Urlichs
2005-05-28  7:55         ` [OT] if (4 < number_of_children) you're in trouble Junio C Hamano
2005-05-25  8:31       ` [PATCH] diff-cache path restriction fix Ingo Molnar
2005-05-25 16:02     ` Florian Weimer

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=87u0kscaob.fsf@windlord.stanford.edu \
    --to=rra@stanford.edu \
    --cc=git@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.