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

Re: [PATCH v1][RFC] symlinks: use unsigned int for flags

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 21, 2026, 09:39 UTC
Message-ID
<aXCey7ysfqORONXr@pks.im>
In-Reply-To
<CA+rU_o6Mrw9ga0TST6p+8MANYaNGiKP9qud8izHL+hwxou9upA@mail.gmail.com>
On Tue, Jan 20, 2026 at 11:36:25PM +0800, Tian Yuchen wrote:
Show 14 quoted lines
> Me as total newbie to the git community (also preparing for GSoC
> 2026), welcome comments or any possible suggestions!
> 
> While preparing v2 to fix the return type of lstat_cache(), a broader
> question regarding coding style came to mind:
> 
> I realized that even without changing the return type, the code
> compiles and runs because of C's implicit integer conversion
>  (since the flag values don't exceed INT_MAX).
> 
> My question is: In the Git codebase, are such "safe" implicit conversions
> generally tolerated to minimize code churn, or is it considered a
> best practice to strictly avoid them and match types explicitly whenever
> possible?

I wouldn't say "strictly". We have lots of cases where we do in fact rely on implicit conversions. In some cases it's a code smell, in lots of other cases it's fine. We have tried to become a bit more mindful around such implicit conversions as those have bitten us in the past, but we're not on a crusade against them.

So I guess the answer is "it depends". A slow trickle of improvements in this area does make sense, but we don't want to convert all of our code base in large patch series just for the sake of it.

Patrick
Previous: Tian YuchenNext: Patrick Steinhardt
Message 3 of 4 in “[RFC] symlinks: use unsigned int for flags”
  1. [RFC] symlinks: use unsigned int for flagsTian Yuchen, Jan 20, 2026
  2. Tian YuchenJan 20, 2026
  3. Patrick SteinhardtJan 21, 2026
  4. Patrick SteinhardtJan 21, 2026

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.