git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff-cache path restriction fix.

From
RARuss 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/>
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 17 in “diff-cache path restriction fix.”
  1. diff-cache path restriction fix.Junio C Hamano, May 25, 2005
  2. Linus TorvaldsMay 25, 2005
  3. Junio C HamanoMay 25, 2005
  4. Linus TorvaldsMay 25, 2005
  5. Junio C HamanoMay 25, 2005
  6. Russ AllberyMay 25, 2005
  7. Junio C HamanoMay 25, 2005
  8. Linus TorvaldsMay 25, 2005
  9. Junio C HamanoMay 25, 2005
  10. Ingo MolnarMay 25, 2005
  11. Linus TorvaldsMay 25, 2005
  12. Junio C HamanoMay 25, 2005
  13. Thomas GlanzmannMay 25, 2005
  14. Matthias UrlichsMay 25, 2005
  15. [OT] if (4 < number_of_children) you're in troubleJunio C Hamano, May 28, 2005
  16. Ingo MolnarMay 25, 2005
  17. Florian WeimerMay 25, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.