Git development
 help / color / mirror / Atom feed
From: Tuomas Ahola <taahol@utu.fi>
To: Junio C Hamano <gitster@pobox.com>
Cc: Thomas Bachem via GitGitGadget <gitgitgadget@gmail.com>,
	<git@vger.kernel.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Thomas Bachem <mail@thomasbachem.com>
Subject: Re: [PATCH] sideband: skip unrecognized allowControlCharacters keywords
Date: Fri, 16 Oct 2026 22:34:30 +0300	[thread overview]
Message-ID: <20261016193430.JZhfl%taahol@utu.fi> (raw)
In-Reply-To: <xmqq8q3xh98n.fsf@gitster.g>

Junio C Hamano <gitster@pobox.com> wrote:

> Tuomas Ahola <taahol@utu.fi> writes:
> 
> > "Thomas Bachem via GitGitGadget" <gitgitgadget@gmail.com> wrote:
> >
> >> +			warning(_("unrecognized value for '%s': '%.*s'"),
> >> +				var, (int)(end - value), value);
> >> +			value = end + !!*end;
> >> +		}
> >
> > Reading CodingGuidelines, it seems that `!!` is a construct we would
> > like to avoid:
> >
> >  - Some clever tricks, like using the !! operator with arithmetic
> >    constructs, can be extremely confusing to others.  Avoid them,
> >    unless there is a compelling reason to use them.
> >
> > --Tuomas
> 
> But here it is compelling.  You want to normalize random byte into 0
> or 1, depending on "is it 0 or non-zero?" criteria, and it certainly
> is easier to read than (*end ? 1 : 0).
> 

Uh, of course.  Sorry for my mental short-circuit.

> Quite honestly, I do not think !! qualifies as "clever trick that is
> confusing" anymore.  Perhaps putting the rule there is misguided.
> 
> Thanks.

Okay.  I'll consider writing a patch to drop that from CodingGuidelines.

      reply	other threads:[~2026-10-16 19:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 12:39 [PATCH] sideband: skip unrecognized allowControlCharacters keywords Thomas Bachem via GitGitGadget
2026-10-16 14:25 ` Tuomas Ahola
2026-10-16 16:28   ` Thomas Bachem
2026-10-16 16:59   ` Junio C Hamano
2026-10-16 19:34     ` Tuomas Ahola [this message]

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=20261016193430.JZhfl%taahol@utu.fi \
    --to=taahol@utu.fi \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=mail@thomasbachem.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox