Re: [2.6 patch][1/3] ipc/ BUG -> BUG_ON conversions

From: Michael Buesch
Date: Sat Aug 28 2004 - 11:56:38 EST


Quoting Adrian Bunk <bunk@xxxxxxxxx>:
> > Anything you put in BUG_ON() must *NOT* have side effects.
> >...
>
> I'd have said exactly the same some time ago, but I was convinced by
> Arjan that if done correctly, a BUG_ON() with side effects is possible
> with no extra cost even if you want to make BUG configurably do nothing.

#if is_debugging_on
# define BUG_ON(x) do { if (unlikely(x)) BUG(); } while (0)
#else
# define BUG_ON(x) do { if (x) { /* nothing */ } } while (0)
#endif

> cu
> Adrian
>

--
Regards Michael Buesch [ http://www.tuxsoft.de.vu ]

Attachment: pgp00000.pgp
Description: PGP signature