Re: BUGed to death
Jens Axboe (axboe@suse.de)
Tue, 15 Apr 2003 15:17:16 +0200
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/