All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: Janitor-Question: use __set_bit instead of |=
Date: Tue, 31 May 2011 07:11:35 +0000	[thread overview]
Message-ID: <4DE494A7.60703@bfs.de> (raw)
In-Reply-To: <201105302323.43979.PeterHuewe@gmx.de>



Am 30.05.2011 23:23, schrieb Peter Hüwe:
> Hi Janitors, staging-list
> 
> what is your opinion on using set_bit instead of using |= to set a bit?
> Is it worth the effort to convert  existing |= to set_bit?
> 
> __set_bit
> pro:
> - often implemented in optimized assembly (e.g. for x86)
> - intention might be clearer
> - less error prone
> - "they are the only portable way to set a specific bit"
> according to  Robert Love's Linux Kernel Development third edition, p.183
> 
> cons:
> uses unsigned longs
> 
> 
> |> pro:
> - standard C
> - let's the compiler decide
> - no warnings on chars, shorts, ints
> 
> 

Personaly i do not like it, but to be fair
|= must not be obvious but it depends on the situation.

It is std C and the compiler should handle it.

re,
 wh
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-05-31  7:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 21:23 Janitor-Question: use __set_bit instead of |= Peter Hüwe
2011-05-31  4:49 ` Greg KH
2011-05-31  7:11 ` walter harms [this message]
2011-05-31  9:05 ` Jiri Slaby

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=4DE494A7.60703@bfs.de \
    --to=wharms@bfs.de \
    --cc=kernel-janitors@vger.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 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.