linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mitchell Blank Jr <mitch@sfgoth.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] oops_in_progress is unlikely()
Date: Thu, 11 Sep 2003 22:12:12 -0700	[thread overview]
Message-ID: <20030912051212.GH41254@gaz.sfgoth.com> (raw)
In-Reply-To: <20030910142031.GB2589@elf.ucw.cz>

I feel sorry that my trivial little patch has spawned such a large thread.

Pavel Machek wrote:
> > There comes a point where readability is lost, for no measurable gain.
> 
> Perhaps we should have macros ifu() and ifl(), that would be used as a
> plain if, just with likelyness-indication?

No, I think that would be a move in the wrong direction.

I've already described my personal opinion about unlikely() in a couple
private emails, but for the record:

When I see code like...

	if (unlikely(condition)) {
	}

...it reads to me like...

	if (condition) {	/* Unlikely error case */
	}

In other words it documents the code making it MORE readable than before
(obviously this can be done to excess).  If the compiler can also do
something useful with the information, so much the better.

Perhaps I'm the only one that feels that way, though.

Your ifu/ifl suggestion I think is pretty ugly.  First off, it would break
syntax-highlighting editors which would hurt readability a lot.  Also its
not obvious at all what "ifu (x == 0)" means - you can pretty much guess what
"if (unlikely(x == 0))" does the first time you see it.

-Mitch

      parent reply	other threads:[~2003-09-12  5:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-07  6:42 [PATCH] oops_in_progress is unlikely() Mitchell Blank Jr
2003-09-07 22:13 ` Dave Jones
2003-09-10 14:20   ` Pavel Machek
2003-09-10 14:23     ` Dave Jones
2003-09-10 15:29       ` Pavel Machek
2003-09-10 16:07         ` Richard B. Johnson
2003-09-10 18:31           ` Jamie Lokier
2003-09-10 18:58             ` Richard B. Johnson
2003-09-10 19:02               ` Pavel Machek
2003-09-10 20:12               ` Jamie Lokier
2003-09-10 20:32                 ` Richard B. Johnson
2003-09-10 21:27                   ` Pavel Machek
2003-09-10 21:52                     ` Jamie Lokier
2003-09-10 21:46                   ` Jamie Lokier
2003-09-12  5:12     ` Mitchell Blank Jr [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=20030912051212.GH41254@gaz.sfgoth.com \
    --to=mitch@sfgoth.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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;
as well as URLs for NNTP newsgroup(s).