lkml.org 
[lkml]   [2002]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH]: 2.5.1pre9 change several if (x) BUG to BUG_ON(x)
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:15    [W:0.052 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site