Re: if/else coding style :-)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(apologies, last one on the metrics from me :), as I believe it is more about style than actual numbers at a point)

_maybe_ this is better, and it is pretty close to call now ;)

find -name '*.c' | xargs grep else | wc -l
3719
find -name '*.c' | xargs grep else | grep '}' | wc -l
1986
find -name '*.c' | xargs grep else | grep -v '}' | wc -l
1733

Shyam

On 10/13/2014 04:52 PM, Joe Julian wrote:
Not taking sides, though if I were I would support the kernel style
because I, personally, find it easier to read. Just to clarify the point:
$ find -name '*.c' | xargs grep '} else {' |  wc -l
1284
$ find -name '*.c' | xargs grep else | grep -v '}' | wc -l
1646

On 10/13/2014 01:46 PM, Shyam wrote:
On 10/13/2014 04:34 PM, Jeff Darcy wrote:
----- Original Message -----

+1 to existing Linux kernel style. Moreover, its a style which is used
heavily in existing code base. I don't see any advantage in changing
the
style now.

It's not a change. It's already common in our code, if not actually
the *most* common style.

% find . -name '*.c' | xargs grep '} else {' | wc -l
1284
jeff@odroid3 ~/glusterfs (nsr-design)
% find . -name '*.c' | xargs grep 'else {' | wc -l
1431

Jeff, the above would include the references for "} else {" as well,
so ideally it would be something like, 1431 - 1284 = 147 references to
the other (non-kernel?) style.

Jut tried removing the 'wc -l' pipe and saw the same. So currently
based on this method the metric for "} else {" should be the preferred
one (just stating), or I am doing something wrong at my end :)

Shyam
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://supercolony.gluster.org/mailman/listinfo/gluster-devel

_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://supercolony.gluster.org/mailman/listinfo/gluster-devel
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://supercolony.gluster.org/mailman/listinfo/gluster-devel




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux