Re: [PATCH v3 02/14] odb: fix flags parameter to be unsigned
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Jan 22, 2026, 00:00 UTC
- Message-ID
- <aXFosXv328ZPjlcw@nand.local>
- In-Reply-To
- <20260121211128.GB723458@coredump.intra.peff.net>
On Wed, Jan 21, 2026 at 04:11:28PM -0500, Jeff King wrote:
Show 10 quoted lines
> On Wed, Jan 21, 2026 at 01:50:18PM +0100, Patrick Steinhardt wrote: > > > The `flags` parameter accepted by various `for_each_object()` functions > > is a bitfield of multiple flags. Such parameters are typically unsigned > > in the Git codebase, but we use `enum odb_for_each_object_flags` in > > some places. > > I agree that using "unsigned" instead of "int" for flags is a good > practice in general. But isn't using "unsigned" instead of an enum > strictly worse?
I agree with you that we should be using an enum in these cases over unsigned for the reasons you suggest. I've stumbled over this in the past, so perhaps this is worth adding to the CodingGuidelines?
Thanks, Taylor