From: Han-Wen Nienhuys <hanwen@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com>,
git@vger.kernel.org, "Han-Wen Nienhuys" <hanwenn@gmail.com>
Subject: Re: [PATCH v2] refs.h: make all flags arguments unsigned
Date: Thu, 3 Feb 2022 15:29:42 +0100 [thread overview]
Message-ID: <CAFQ2z_Oxq67XO20oG7Tokk48wm5ZzHRR3GDi4PG5wg7FMJ89aA@mail.gmail.com> (raw)
In-Reply-To: <xmqq8ruub35i.fsf@gitster.g>
On Wed, Feb 2, 2022 at 12:03 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> 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
next prev parent reply other threads:[~2022-02-03 14:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 20:15 [PATCH] refs.h: make all flags arguments unsigned Han-Wen Nienhuys via GitGitGadget
2022-02-01 2:02 ` Junio C Hamano
2022-02-01 11:47 ` Han-Wen Nienhuys
2022-02-01 18:41 ` Junio C Hamano
2022-02-01 12:46 ` [PATCH v2] " Han-Wen Nienhuys via GitGitGadget
2022-02-01 20:20 ` Ævar Arnfjörð Bjarmason
2022-02-01 23:03 ` Junio C Hamano
2022-02-03 14:29 ` Han-Wen Nienhuys [this message]
2022-02-03 17:53 ` Ævar Arnfjörð Bjarmason
2022-02-03 18:16 ` Han-Wen Nienhuys
2022-02-03 21:20 ` Ævar Arnfjörð Bjarmason
2022-02-03 18:27 ` Junio C Hamano
2022-02-03 18:33 ` Han-Wen Nienhuys
2022-02-03 19:15 ` Junio C Hamano
2022-02-03 14:26 ` [PATCH v3 0/2] " Han-Wen Nienhuys via GitGitGadget
2022-02-03 14:26 ` [PATCH v3 1/2] " Han-Wen Nienhuys via GitGitGadget
2022-02-03 14:26 ` [PATCH v3 2/2] Uniformize flag argument naming to `flags` or `unused_flags` Han-Wen Nienhuys via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFQ2z_Oxq67XO20oG7Tokk48wm5ZzHRR3GDi4PG5wg7FMJ89aA@mail.gmail.com \
--to=hanwen@google.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=hanwenn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).