lkml.org 
[lkml]   [2009]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] percpu: explain quick paths in pcpu_[de]populate_chunk()
Hello,

On 12/01/2009 11:02 AM, Cong Wang wrote:
> Nope, comments can never fix bad code.
>
> Since these two break statements are intentional, why not use if?
> Logically, the following two are equalent.
>
> for(a1; a2; a3){
> if (a4)
> return;
> break;
> }
>
>
> a1;
> if (a2) {
> if (a4)
> return;
> }
>
> And the latter is much more readable than the former.

I thought about that but didn't want to open code the special and
fairly complex loop construct used there. To me, it seemed using the
same loop construct would be much less error-prone than open coding
the loop mostly because those two special cases are the only place
where that is necessary. Maybe we can add pcpu_first_[un]pop_region()
macros and use them there but is the first iteration check that bad
even with sufficient explanations?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2009-12-01 06:03    [W:0.063 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site