Re: [PATCH] BUILD_BUG_ON sucks

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Rusty Russell
Date: Saturday, August 16, 2008 - 3:55 am

On Saturday 16 August 2008 20:09:48 Alexey Dobriyan 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".

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.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] BUILD_BUG_ON sucks, Alexey Dobriyan, (Sat Aug 16, 3:09 am)
Re: [PATCH] BUILD_BUG_ON sucks, Rusty Russell, (Sat Aug 16, 3:55 am)
Re: [PATCH] BUILD_BUG_ON sucks, Andrew Morton, (Sat Aug 16, 10:46 am)
Re: [PATCH] BUILD_BUG_ON sucks, Linus Torvalds, (Sat Aug 16, 1:07 pm)
Re: [PATCH] BUILD_BUG_ON sucks, Theodore Tso, (Sun Aug 17, 5:19 am)
Re: [PATCH] BUILD_BUG_ON sucks, Andrew Morton, (Sun Aug 17, 9:33 am)