Re: [PATCH v2] refs.h: make all flags arguments unsigned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 2, 2022 at 12:03 AM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:
>
> > The post-image LGTM, but I'm also a bit "meh" on the churn just for
> > signed->unsigned, especially given the conflict with my in-flight
> > ab/no-errno-from-resolve-ref-unsafe. But it's not too bad, and if Junio
> > hasn't complained about it...
>
> I won't complain myself.  I'd still try to help newer developers,
> but my intention is to make it the responsibility for individual
> developers to make sure their topic works well with topics in
> flight ;-)

I'm sending v3 based on seen.

> Between "enum" and #define that is stored in "unsigned", neither
> gives us much type safety in C; "enum" may be somewhat worse by
> giving a false sense of having a type safety that does not really
> exist, than "unsigned int" that is more honestly defeats such a
> false sense of safety.  So I have no strong preference either way.

Neither gives true type safety, and I don't know if an enum is kosher
at all; shouldn't the value always be one of the enumerees, strictly
speaking?

I proposed both options because a distinct typename lets me jump to
the definition of the flags easily through ctags.

Another idea is to mark the type of the flags by its name, eg.
transaction_flags, resolve_flags, reftype_flags etc. This wouldn't
help with ctags, but it does help with readability.

-- 
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux