From: vlobanov <vlobanov@speakeasy.net>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: Mitchell Blank Jr <mitch@sfgoth.com>,
krishna <krishna.c@globaledgesoft.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Significance of do ... while (0)
Date: Thu, 16 Dec 2004 23:58:51 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.58.0412162354030.26987@shell3.speakeasy.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0412170843530.14529@yvahk01.tjqt.qr>
> >> Can any one explain the importance of do ... while (0)
> >
> >It's a standard C programming practice; more info is available from
> >your local search engine:
> > http://www.google.com/search?lr=&c2coff=1&q=%22while%280%29%22
>
> Why? {} would suffice, no need to do{}while(0)
>
>
>
> Jan Engelhardt
> --
> ENOSPC
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
Unless I'm mistaken, it won't work in all cases. Example:
#define foo(...) { ... /* nefarious macro stuff here */ ... }
if (some_condition)
foo();
else
// do something nifty
The above would expand to:
if (some_condition) {
/* nefarious macro stuff here */
};
else
// do something nifty
And that's not quite right.
-Vadim Lobanov
next prev parent reply other threads:[~2004-12-17 7:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-17 4:09 krishna
2004-12-17 4:21 ` Dave Jones
2004-12-17 4:54 ` krishna
2004-12-17 4:29 ` Mitchell Blank Jr
2004-12-17 7:44 ` Jan Engelhardt
2004-12-17 7:58 ` vlobanov [this message]
2004-12-17 8:06 ` Jan Engelhardt
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=Pine.LNX.4.58.0412162354030.26987@shell3.speakeasy.net \
--to=vlobanov@speakeasy.net \
--cc=jengelh@linux01.gwdg.de \
--cc=krishna.c@globaledgesoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mitch@sfgoth.com \
/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®