Re: [PATCH] diff-cache path restriction fix.
- From
- Russ Allbery <rra@stanford.edu>
- Date
- May 25, 2005, 02:16 UTC
- Message-ID
- <87u0kscaob.fsf@windlord.stanford.edu>
- In-Reply-To
- <7v3bscqdlr.fsf@assigned-by-dhcp.cox.net>
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.
Show 5 quoted lines
> 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/>