From: DervishD <raul@pleyades.net>
To: Joshua Stewart <joshua.stewart@comcast.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: A little explanation needed
Date: Sun, 22 Dec 2002 21:12:23 +0100 [thread overview]
Message-ID: <20021222201223.GC46@DervishD> (raw)
In-Reply-To: <1040535392.1518.3.camel@localhost.localdomain>
Hi Joshua :)
> In otherwords, what's the use of a do{X}while(0) "loop" instead of
> just X. I'm not the world's best trained C programmer, so forgive
> me if I sound stupid.
First, you do not sound stupid at all.
Second. The do...while use in macros is to avoid the 'swallow
semicolon' effect ;)) In other words, it makes the entire macro
appear as a single statement. This avoids problems with 'else'
constructs with macros that expand to multiple statements.
Someplace in the GNU cpp documentation you can find a far better
explanation of this effect and why the do...while helps (it makes the
macro a single statement...).
Hope that helps :)
Raúl
prev parent reply other threads:[~2002-12-22 20:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-22 5:36 A little explanation needed Joshua Stewart
2002-12-22 5:35 ` Greg KH
2002-12-22 21:07 ` Joshua Stewart
2002-12-22 20:12 ` DervishD [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=20021222201223.GC46@DervishD \
--to=raul@pleyades.net \
--cc=joshua.stewart@comcast.net \
--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 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.