Re: BUGed to death

From: Jens Axboe (axboe@suse.de)
Date: Tue Apr 15 2003 - 08:17:16 EST


On Tue, Apr 15 2003, Roman Zippel wrote:
> Hi,
>
> On Tue, 15 Apr 2003, Jens Axboe wrote:
>
> > > What happens if you just turn BUG_ON into "do {} while (0)"?
> >
> > If you do that, you must audit every single BUG_ON to make sure the
> > expression doesn't have any side effects.
> >
> > BUG_ON(do_the_good_stuff());
>
> This should avoid the problem:
>
> #define BUG_ON(cond) do { if (cond); } while (0)

Yes I'm aware of the problem being fixable, the above is not likely to
be fast than BUG_ON(). My point was just that you cannot simply count on
being able to make BUG_ON a noop, some thought has to go into it.

-- 
Jens Axboe

- 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/



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:35 EST