Discussion:
Which code style should we follow?
Gris Ge
2015-06-09 11:01:46 UTC
Permalink
Hi Guys,

In order to be consistent on code style, I would suggest we pick an
code style and follow it:

1. K&R style:
http://en.wikipedia.org/wiki/Indent_style#K.26R_style

2. Linux Kernel style:
https://www.kernel.org/doc/Documentation/CodingStyle
# 8 wide tab.

3. GNU style:
http://www.gnu.org/prep/standards/standards.html

4. LibVirt style:
http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=HACKING;hb=HEAD
Looks like GNU function declaration style + K&R indent style.

The manpage of indent(1L) 'COMMON STYLES' section is also an good.

Current code is more like 'K&R style' + expand tab to 4 space which
could formated via command "indent -kr --no-tabs --tab-size4 <file>".

Should we stick to "K&R + expand tab 4" or switch to other style?

Best regards.
--
Gris Ge
Tony Asleson
2015-06-09 14:55:25 UTC
Permalink
Post by Gris Ge
Current code is more like 'K&R style' + expand tab to 4 space which
could formated via command "indent -kr --no-tabs --tab-size4 <file>".
Should we stick to "K&R + expand tab 4" or switch to other style?
I vote to stick with what we have, document it and make it consistent if
we have some variability.

-Tony

Loading...