mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, Jiri Slaby <jslaby@suse.cz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [GIT pull] core/urgent for v5.4-rc7
Date: Mon, 11 Nov 2019 17:37:26 -0800	[thread overview]
Message-ID: <24e38dd1be9e0f6e4520cb81f72e27b88dae4015.camel@perches.com> (raw)
In-Reply-To: <CAHk-=wgmeR6nJqYFZAUOxBkUTfySE_dEV7HOB0wwzQ0e-_y4dA@mail.gmail.com>

On Mon, 2019-11-11 at 09:12 -0800, Linus Torvalds wrote:
> On Sun, Nov 10, 2019 at 5:50 PM Joe Perches <joe@perches.com> wrote:
> > The !! logical usage is not particularly common in the kernel.
> > There seems to be only a couple/few dozen.
> 
> Your grep pattern is for the explicitly silly "turn a boolean to a
> boolean". That should certainly be rare.
> 
> But I meant it in a more general way - there's a lot of common use of
> "!!" for "turn this expression into a boolean". A trivial grep for
> that (didn't check how correct it was - there might be comments that
> are very excited too) implies that we have a fair amount of this
> pattern:
> 
>     $ git grep '[^!]!![^!]' -- '*.[ch]' | wc -l
>     7007

Likely the majority of those are bit comparison coercions to 0/1 like

	int val = !!(A & B)

> so the '!!' pattern itself isn't rare.

And likely these !! patterns are preferred to (A & B) != 0

I don't care much either way as either form, unlike !!(A == B),
is not redundant.



      reply	other threads:[~2019-11-12  1:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-10 10:21 Thomas Gleixner
2019-11-10 10:21 ` [GIT pull] x86/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] timers/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] irq/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] perf/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] sched/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 21:00 ` [GIT pull] core/urgent " pr-tracker-bot
2019-11-10 22:00 ` Joe Perches
2019-11-10 22:35   ` Linus Torvalds
2019-11-11  1:50     ` Joe Perches
2019-11-11 17:12       ` Linus Torvalds
2019-11-12  1:37         ` Joe Perches [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=24e38dd1be9e0f6e4520cb81f72e27b88dae4015.camel@perches.com \
    --to=joe@perches.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®