Subject: Re: [PATCH v3 02/14] odb: fix flags parameter to be unsigned

From: Taylor Blau <[email-masked]>
Date: Wed, 21 Jan 2026 19:00:49 -0500

On Wed, Jan 21, 2026 at 04:11:28PM -0500, Jeff King wrote:
> 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