lkml.org 
[lkml]   [2005]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/9] Cleanup kmem_cache_create()
Ingo Oeser wrote:
> On Friday 11 November 2005 01:04, Matthew Dobson wrote:
>
>>- if (size < 4096 || fls(size - 1) == fls(size - 1 + 3 * BYTES_PER_WORD))
>>+ if (size < RED_ZONE_LIMIT ||
>>+ fls(size - 1) == fls(size - 1 + 3 * BYTES_PER_WORD))
>> flags |= SLAB_RED_ZONE|SLAB_STORE_USER;
>
>
> I would suggest sth. like
>
> if (size < RED_TONE_LIMIT
> || fls(size - 1) = fls(size - 1 + 3 * BYTES_PER_WORD))
> flags |= SLAB_RED_ZONE | SLAB_STORE_USER
>
>
> Reason: A binary operator in front is a huge hint
> that this is a continued line.
>
> Just compare when you go to a store next time.
>
> 1
> + 2
> - 3
> * 4
>
> is much more readable then
>
> 1 +
> 2 -
> 3 *
> 4
>
> right?
>
>
> Regards
>
> Ingo Oeser

You make a very good point. It's not the way that I'm used to writing
multi-line ifs, but it is a bit more readable. However, since the rest of
the multi-line ifs in the file have the binary operator at the end of the
first line, I'm inclined to leave it the way it is for consistency. If
anyone really feels strongly, I could come up with a patch for the whole
file...?

Thanks for the feedback!

-Matt
-
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-11-11 19:31    [W:0.061 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site