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

Re: [Newcomer][PATCH] graph.c: change graph_line->width type to int to remove sign-compare warning

From
OCO. C. <ocarneiro1@gmail.com>
Date
May 23, 2025, 03:25 UTC
Message-ID
<CADHqMhY85ZUd=NVq9dfUrBZEzEhfqwc-iYh=gcQ9J1hg=EkAsg@mail.gmail.com>
In-Reply-To
<xmqqtt5d7e9z.fsf@gitster.g>
On Wed, May 21, 2025 at 8:08 PM Junio C Hamano <gitster@pobox.com> wrote:
> An obvious question after reading the above explanation is if it
> also would be a valid solution to change the type of git_graph.width
> to match the type of graph_line.width instead.  And if so, what was
> the reason why you chose to match their types in this direction?

While writing the patch, I saw how the git_graph and graph_line structs related to each other, and understood git_graph as being the "more important" struct in this context. So, it seemed more reasonable to have graph_line.width comply with git_graph.width type.

I do see the opposite point, taking notice of graph_line.width interactions with "size_t". With those in mind, having the type as "size_t" does also make a lot of sense.

However, considering that:
> "git log --graph" output is certainly something that should not exceed
> thousands for sane people
It feels intuitive to " use platform natural "int" " as you put it.
> By the way, these lines are overly long.  We aim to limit our (physical) line
> length to around 70 chars or so by line wrapping.
Sorry about that, I'll keep them shorter.

Lastly, thanks for the quick and careful response to the patch. As a first timer I appreciate the discussion.

- Octavio
Previous: Junio C Hamano
Message 3 of 3 in “graph.c: change graph_line->width type to int to remove sign-compare warning”
  1. Octavio CarneiroMay 21, 2025
  2. Junio C HamanoMay 21, 2025
  3. O. C.May 23, 2025

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.