Messages in this thread | | | Date | Sat, 16 Aug 2008 13:07:51 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH] BUILD_BUG_ON sucks |
| |
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
| |