Re: [PATCH] BUILD_BUG_ON sucks
From: Linus Torvalds
Date: Sat Aug 16 2008 - 16:08:17 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/