[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200808162055.45136.rusty@rustcorp.com.au>
Date: Sat, 16 Aug 2008 20:55:44 +1000
From: Rusty Russell <rusty@...tcorp.com.au>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: torvalds@...l.org, akpm@...l.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] BUILD_BUG_ON sucks
On Saturday 16 August 2008 20:09:48 Alexey Dobriyan wrote:
> BUILD_BUG_ON should have never existed -- BUG_ON could upgrade itself to
> compile-breaking version if compiler has enough information and this is
> what patch does.
>
> The only downside is that one can't write BUG_ON(1) anymore.
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".
But maybe I just like it because we have it. At very least BUILD_BUG_ON
should definitely compile-barf on a non-constant expr, and vice versa for
BUG_ON().
Note that BUG_ON() is a hack caused by lack of attribute((cold)). "if (x)
BUG()" is clearer, and possible in the long run as people upgrade compilers.
Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists