From: Paolo Ornati <ornati@fastwebnet.it>
To: "Kotian, Deepak" <Deepak.Kotian@patni.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: Purpose of do{}while(0) in #define spin_lock_init(x) do { (x)->lock = 0; } while(0)
Date: Wed, 5 Jan 2005 15:14:23 +0100 [thread overview]
Message-ID: <20050105151423.68e0d404@tux.homenet> (raw)
In-Reply-To: <374639AB1012AA4C840022842AA95BC203E0E7E3@ruby.patni.com>
On Wed, 5 Jan 2005 19:31:44 +0530
"Kotian, Deepak" <Deepak.Kotian@patni.com> wrote:
> Is there any specific reason why do{}while(0) is
> there in this definition
> #define spin_lock_init(x) do { (x)->lock = 0; } while(0)
>
> What could happen if it is replaced by
> #define spin_lock_init(x) { (x)->lock = 0; }
>
> There are couple of other places, where this kind of usage
> is observed in the kernel code.
look at http://www.kernelnewbies.org/faq/
--
Paolo Ornati
Gentoo Linux (kernel 2.6.10-cko2)
next prev parent reply other threads:[~2005-01-05 14:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-05 14:01 Kotian, Deepak
2005-01-05 14:14 ` Paolo Ornati [this message]
2005-01-05 14:15 ` Bernd Petrovitsch
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=20050105151423.68e0d404@tux.homenet \
--to=ornati@fastwebnet.it \
--cc=Deepak.Kotian@patni.com \
--cc=linux-kernel@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 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®