From: hpa@zytor.com (H. Peter Anvin)
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.6] bootmem.c cleanup
Date: Mon, 17 May 2004 00:43:16 +0000 (UTC) [thread overview]
Message-ID: <c891r4$5i3$1@terminus.zytor.com> (raw)
In-Reply-To: 20040514133353.236acf3a.akpm@osdl.org
Followup to: <20040514133353.236acf3a.akpm@osdl.org>
By author: Andrew Morton <akpm@osdl.org>
In newsgroup: linux.dev.kernel
>
> Michael Buesch <mbuesch@freenet.de> wrote:
> >
> > - if (!test_and_clear_bit(i, bdata->node_bootmem_map))
> > - BUG();
> > + BUG_ON(!test_and_clear_bit(i, bdata->node_bootmem_map));
>
> Please don't put expressions whihc actually change state inside BUG_ON().
> Someone may decide to make BUG_ON() a no-op to save space.
>
> I'm not aware of anyone actually trying that, but it's a good objective.
>
If so they should make it:
#define BUG_ON(x) ((void)(x))
.. which preserves side effects while generating no object code for a
side-effect-free expression.
The only reason for the cast to (void) at all is to keep gcc from
complaining about an ignored expression.
-hpa
next prev parent reply other threads:[~2004-05-17 0:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-14 20:05 [PATCH 2.6.6] bootmem.c cleanup Michael Buesch
2004-05-14 20:33 ` Andrew Morton
2004-05-14 20:43 ` Michael Buesch
2004-05-17 0:43 ` H. Peter Anvin [this message]
2004-05-18 19:50 ` Matt Mackall
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='c891r4$5i3$1@terminus.zytor.com' \
--to=hpa@zytor.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