lkml.org 
[lkml]   [2014]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3] staging: panel: (coding style) Matching braces
From
Date
On Mon, 2014-05-26 at 16:28 +0200, Willy Tarreau wrote:
> I believe that most of the kernel code prefers the two-line format resluting
> in this instead :
>
> }
> else if (*esc >= 'A' && *esc <= 'Z') {
> value |= (*esc - 'A' + 10) << shift;
> }
> else if (*esc >= 'a' && *esc <= 'z') {
> value |= (*esc - 'a' + 10) << shift;
> }
> else {

grep shows what kernel style is most used.

Your form:
}
else if (...) {

(This shows 3 lines per instance)
$ grep-2.5.4 -rP --include=*.[ch] '}\n[ \t]*else if.*{\n' * | wc -l
909

Generally used form:
} else if (...) {

(mostly shows 2 lines per instance)
$ grep-2.5.4 -rP --include=*.[ch] '} else if.*{\n' * | wc -l
31653

That's ~50:1 preference for "} else if (...) {"

> It's just a matter of taste I know,

true enough.




\
 
 \ /
  Last update: 2014-05-26 20:01    [W:0.108 / U:3.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site