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

Re: [PATCH 3/3] diff --stat: sometimes use non-linear scaling.

From
Junio C Hamano <junkio@cox.net>
Date
Sep 27, 2006, 07:05 UTC
Message-ID
<7vfyedg56m.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64N.0609262320260.9088@attu4.cs.washington.edu>
David Rientjes <rientjes@cs.washington.edu> writes:
> Your argument of saying to yourself "if line_width cannot fit max + len 
> then we do this" has no relevance at all.  I can say "if max + len is too 
> big for line_width we do this" just the same.

Actually that is exactly my point. "Just the same". There is no reason to choose one way or the other from purely logical or mathematical point of view.

Comparisons written always in textual order, when one gets used to, takes less thinking to parse and understand, and that is what I'm used to. Have number line handy in your head and you will hopefully like it too ;-).

Show 10 quoted lines
>> Well, the program _firstly_ matches the logic flow better, and
>> _in_ _addition_ if you write it another way it becomes
>> unnecessarily too deeply indented.  So while I agree with you as a
>> general principle that indentation depth should not dictate how
>> we code it does not apply to this particular example.
>
> This is a ridiculous argument.  The C code will emit the exact same 
> assembly regardless of how you write it.  You say that you wrote it that 
> way to avoid idents which is an absolutely horrible way to dictate the 
> code you use.

I guess probably I was unclear (I did not talk anything about code generation -- where did it come from?). I say I wrote it that way _firstly_ because the flow of the program matches exactly what I saw the code needed to do -- if A I do not have to do anything else if B I do this else I do that. In addition not having that "do nothing" made the code indent unnecessarily deep but that is "in addition" and not the primary cause. It was an added bonus.

Show 8 quoted lines
> And in one of your patches you had:
> 	if (...)
> 		;
> 	else {
> 		...
> 	}
>
> without any other if statements.
Yes, indeed that was very funny looking.

It was refactored from the final one that had "else if" in the middle (else if was to add the non-linear scaling). I agree that any sane would not have done that if that was the real first version.

Previous: David RientjesNext: David Rientjes
Message 7 of 18 in “diff --stat: sometimes use non-linear scaling.”
  1. 3/3 diff --stat: sometimes use non-linear scaling.Junio C Hamano, Sep 27, 2006
  2. David RientjesSep 27, 2006
  3. Junio C HamanoSep 27, 2006
  4. David RientjesSep 27, 2006
  5. Junio C HamanoSep 27, 2006
  6. David RientjesSep 27, 2006
  7. Junio C HamanoSep 27, 2006
  8. David RientjesSep 27, 2006
  9. Johannes SchindelinSep 27, 2006
  10. Petr BaudisOct 6, 2006
  11. Johannes SchindelinSep 27, 2006
  12. Martin WaitzSep 27, 2006
  13. Linus TorvaldsSep 27, 2006
  14. Martin WaitzSep 28, 2006
  15. Junio C HamanoSep 28, 2006
  16. Andreas EricssonSep 29, 2006
  17. Johannes SchindelinSep 27, 2006
  18. SeanSep 27, 2006

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.