From: Linus Torvalds <torvalds@linux-foundation.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
torvalds@linuxfoundation.org, akpm@linuxfoundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] BUILD_BUG_ON sucks
Date: Sat, 16 Aug 2008 13:07:51 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0808161305170.3324@nehalem.linux-foundation.org> (raw)
In-Reply-To: <200808162055.45136.rusty@rustcorp.com.au>
On Sat, 16 Aug 2008, Rusty Russell wrote:
>
> Interesting idea, but I've come to actually like the semantic explicitness of
> BUILD_BUG_ON. There's a difference between "we should never get here"
> and "this should never exist".
Agreed. I think Alexey's patch is broken.
The thing is, BUILD_BUG_ON() is a different thing. It says "this is a
build error", while BUG_ON() says "this is an error if we reach it".
Very different.
The fact that you broke BUG_ON(1) should have made you think. Sometimes
the "1" isn't necessarily a constant one. It might be
if (something_that_can_never_happen_in_some_configuration) {
...
BUG_ON(CONFIG_XYZZY);
...
}
where the BUG_ON(1) is absolutely *not* the same thing as BUILD_BUG_ON().
Linus
next prev parent reply other threads:[~2008-08-16 20:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-16 10:09 Alexey Dobriyan
2008-08-16 10:55 ` Rusty Russell
2008-08-16 20:07 ` Linus Torvalds [this message]
2008-08-17 10:32 ` [PATCH] debug: fix BUILD_BUG_ON() for non-constant expressions Ingo Molnar
2008-08-17 16:56 ` Linus Torvalds
2008-08-17 17:33 ` Ingo Molnar
2008-08-17 17:53 ` Ingo Molnar
2008-08-17 18:39 ` Linus Torvalds
2008-08-17 18:45 ` Ingo Molnar
2008-08-18 1:09 ` Rusty Russell
2008-08-18 7:54 ` Ingo Molnar
2008-08-18 9:55 ` Boaz Harrosh
2008-08-18 12:32 ` Boaz Harrosh
2008-08-19 13:34 ` Ingo Molnar
2008-08-19 16:33 ` Boaz Harrosh
2008-08-20 10:59 ` Ingo Molnar
2008-08-20 12:31 ` Boaz Harrosh
2008-08-20 12:39 ` adobriyan
2008-08-20 13:07 ` Boaz Harrosh
2008-08-21 12:17 ` Ingo Molnar
2008-08-25 1:19 ` Rusty Russell
2008-08-20 13:21 ` Boaz Harrosh
2008-08-16 17:46 ` [PATCH] BUILD_BUG_ON sucks Andrew Morton
2008-08-17 12:19 ` Theodore Tso
2008-08-17 16:33 ` Andrew Morton
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=alpine.LFD.1.10.0808161305170.3324@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@linuxfoundation.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®