如题。
|
bitsmixFeb 17, 2012
1
如果团队有规范,就按照规范写呗。
自己写东西,那就全看自己乐意啥样了。 |
|
bitsmixFeb 17, 2012
2
渊源的话,我记得 K & R 里面都是
int foo(int number) { return 42; } 这样的。 |
|
bitsmixFeb 17, 2012
3
。。。。。。。 v2ex 把 space 给去了 ><
|
|
5
<code>
void foo(){ printf("hello"); } </code> 测试下 |
|
bitsmixFeb 17, 2012
7
|
|
marvinIIFeb 17, 2012
9
<<Code Complete 2>>里推荐的是K&R风格. 主要是所谓dominate: 函数signature dominate 函数体.
习惯一种风格的话, 看其他的都有些强迫症的感觉. |
|
wszfFeb 17, 2012
11
public void xxxx()
{ //我喜欢上下对称:) } |
|
icyflashFeb 17, 2012
14
看团队编码习惯,这个可以设置的。
|
|
hipengFeb 17, 2012
15
k&r应该是这样的:
编码风格左大括号在行尾,右大括号在行首 while () { ... } 函数例外: void foo() { ... } http://www.kernel.org/doc/Documentation/CodingStyle http://www.gnu.org/prep/standards/standards.html |