Re: [PATCH]: 2.5.1pre9 change several if (x) BUG to BUG_ON(x)

Jordi (mumismo@wanadoo.es)
Sun, 6 Jan 2002 17:10:27 +0100


On Sunday 06 January 2002 15:48, Momchil Velikov wrote:

>
> Alan> Your patch looks wrong (ook ook! 8)) - if you build without BUG
> enabled you Alan> don't make various function calls with your change.
> BUG_ON has the C nasty Alan> assert() does that makes it a horrible
> horrible idea and its unfortunate Alan> it got put in.
>
> Alan> BUG_ON(function(x,y))
>
> #ifdef DEBUG
> #define BUG_ON(x) if (x) BUG()
> #else
> #define BUG_ON(x) (void)(x)
> #endif

Sorry but in 2.5.2 pre9 (i make a mistake in the topic, is 2.5.2pre9 , no
2.5.1pre9):
kernel.h:
#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)

So i don't understand Alan's complaims, if i understands it well, BUG_ON() is
just a optimization of BUG function.
So in simple "if (condition) BUG()" cases i think it will allways be replaced
, of course in "if (condition) someWork; BUG()" we can't.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/