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

Re: [GSoC][PATCH 1/1] add: use unsigned type for collection of bits

From
Christian Couder <christian.couder@gmail.com>
Date
Feb 26, 2024, 09:59 UTC
Message-ID
<CAP8UFD3qR8E0gvUQtzzkLPWv4Db45kFS4pEqHKQr5siciVJ-zQ@mail.gmail.com>
In-Reply-To
<20240224112638.72257-2-giganteeugenio2@gmail.com>

On Sat, Feb 24, 2024 at 12:28 PM Eugenio Gigante <giganteeugenio2@gmail.com> wrote:

>
> The function 'refresh' in 'builtin/add.c' declares 'flags' as signed,
> while the function 'refresh_index' defined in 'read-cache-ll.h' expects an unsigned value.

It's not clear from the patch that refresh() passes 'flags' as an argument to refresh_index(), so it might help reviewers a bit if you could tell that.

> Since in this case 'flags' represents a bag of bits, whose MSB is not used in special ways,
> this commit changes the type of 'flags' to unsigned.

We prefer to use "let's change this and that" or just "change this and that" rather than "this commit changes this and that", see https://git-scm.com/docs/SubmittingPatches/#imperative-mood.

It might help if you could add a bit more explanation about why it's a good thing to use an unsigned variable instead of a signed one. For example you could say that it documents that we are not doing anything funny with the MSB.

> Signed-off-by: Eugenio Gigante <giganteeugenio2@gmail.com>
> ---
>  builtin/add.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
The patch looks correct, thanks!
Previous: Eugenio GiganteNext: Junio C Hamano
Message 3 of 7 in “Use unsigned integral type for collection of bits.”
  1. Eugenio GiganteFeb 24, 2024
  2. [GSoC][PATCH 1/1] add: use unsigned type for collection of bitsEugenio Gigante, Feb 24, 2024
  3. Christian CouderFeb 26, 2024
  4. Junio C HamanoFeb 26, 2024
  5. [GSoC][PATCH v2 0/1] Use unsigned integral type for collection of bits.Eugenio Gigante, Feb 29, 2024
  6. 1/1 add: use unsigned type for collection of bitsEugenio Gigante, Feb 29, 2024
  7. Junio C HamanoFeb 29, 2024

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.