From: "Kotian, Deepak" <Deepak.Kotian@patni.com>
To: <linux-kernel@vger.kernel.org>
Subject: Purpose of do{}while(0) in #define spin_lock_init(x) do { (x)->lock = 0; } while(0)
Date: Wed, 5 Jan 2005 19:31:44 +0530 [thread overview]
Message-ID: <374639AB1012AA4C840022842AA95BC203E0E7E3@ruby.patni.com> (raw)
Just for information, may be very simple.
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.
Thanks and Regards
Deepak
next reply other threads:[~2005-01-05 14:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-05 14:01 Kotian, Deepak [this message]
2005-01-05 14:14 ` Paolo Ornati
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=374639AB1012AA4C840022842AA95BC203E0E7E3@ruby.patni.com \
--to=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®