From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Lin Sun" <lin.sun@zoom.us>,
"Đoàn Trần Công Danh" <congdanhqx@gmail.com>,
"David Aguilar" <davvid@gmail.com>, "Jeff King" <peff@peff.net>
Subject: Re: [PATCH 4/5] config.c: add a "tristate" helper
Date: Thu, 08 Apr 2021 16:51:52 -0700 [thread overview]
Message-ID: <xmqqtuogpc6f.fsf@gitster.g> (raw)
In-Reply-To: <875z0wicmp.fsf@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Fri, 09 Apr 2021 01:23:58 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> I'd prefer to just make these "enum", which means we'll have the aid of
> the compiler in checking all the callsites, as in the patch-on-top
> (which I can squash appropriately, need to update the doc comments
> though) at the end of this E-Mail.
I think enum is oversold by some people (not me). C Compilers won't
do much when you use them interchangeably with int, simply because
they are designed to be used that way, no?
If existing code used 0 as false and 1 as true, and it learns an
"auto" value with a new definition,
#define TRISTATE_AUTO 2
without TRISTATE_{TRUE,FALSE} defined to 0 and 1, that would be a
good place to stop. I'd be quite happy with that.
next prev parent reply other threads:[~2021-04-08 23:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 13:34 [PATCH 0/5] config: support --type=bool-or-auto for "tristate" parsing Ævar Arnfjörð Bjarmason
2021-04-08 13:34 ` [PATCH 1/5] config.c: add a comment about why value=NULL is true Ævar Arnfjörð Bjarmason
2021-04-08 18:10 ` Junio C Hamano
2021-04-08 13:34 ` [PATCH 2/5] config tests: test for --bool-or-str Ævar Arnfjörð Bjarmason
2021-04-08 18:21 ` Junio C Hamano
2021-04-08 23:11 ` Ævar Arnfjörð Bjarmason
2021-04-08 13:34 ` [PATCH 3/5] git-config: document --bool-or-str and --type=bool-or-str Ævar Arnfjörð Bjarmason
2021-04-08 18:22 ` Junio C Hamano
2021-04-08 13:34 ` [PATCH 4/5] config.c: add a "tristate" helper Ævar Arnfjörð Bjarmason
2021-04-08 18:33 ` Junio C Hamano
2021-04-08 23:23 ` Ævar Arnfjörð Bjarmason
2021-04-08 23:51 ` Junio C Hamano [this message]
2021-04-09 1:33 ` Ævar Arnfjörð Bjarmason
2021-04-09 12:53 ` Junio C Hamano
2021-04-08 23:54 ` Junio C Hamano
2021-04-09 20:05 ` Jeff King
2021-04-09 22:11 ` Junio C Hamano
2021-04-10 1:23 ` Jeff King
2021-04-10 1:43 ` Junio C Hamano
2021-04-08 13:34 ` [PATCH 5/5] config: add --type=bool-or-auto switch Ævar Arnfjörð Bjarmason
2021-04-08 18:36 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtuogpc6f.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=congdanhqx@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=lin.sun@zoom.us \
--cc=peff@peff.net \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.