lkml.org 
[lkml]   [2004]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [2.6 patch][1/3] ipc/ BUG -> BUG_ON conversions
On Sat, Aug 28 2004, Andrew Morton wrote:
> Adrian Bunk <bunk@fs.tum.de> wrote:
> >
> > > 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.
>
> Nevertheless, I think I'd prefer that we not move code which has
> side-effects into BUG_ONs. For some reason it seems neater that way.
>
> Plus one would like to be able to do
>
> BUG_ON(strlen(str) > 22);
>
> and have strlen() not be evaluated if BUG_ON is disabled.
>
> A minor distinction, but one which it would be nice to preserve.

Precisely, I fully agree (even though BUG_ON() will never be defined
away, if you should not do the check kill it completely).

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

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