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