把如果语句下面的码区的开头结尾写在同一个列位置好还是不好
所有跟贴
·
加跟贴
·
新语丝读书论坛
送交者: HunHunSheng 于 2008-01-30, 11:14:02:
Which is better? I am wrtiting SOP and I prefer the later
if (x>2) {
y=x*x;
}
else {
y=x;
}
or
if (x>2)
{
y=x*x;
}
else
{
y=x;
}
所有跟贴:
? (无内容)
-
forex
(0 bytes)
2008-01-31, 15:29:07
(202153)
昏君没事干这个干嘛
-
3322
(18 bytes)
2008-01-30, 11:28:16
(201543)
第一种更专业。俺早年看过一本讲编程风格的书《代码大全》也是这样讲的。
-
Amsel
(167 bytes)
2008-01-30, 11:21:35
(201537)
我要求手下人必须按第一种写。
-
bluesea
(56 bytes)
2008-01-30, 11:15:45
(201531)
or if you want to work on GNU project, the second is GNU coding standard. (无内容)
-
steven
(0 bytes)
2008-01-30, 13:08:20
(201612)
第一种不好很难一各一个的寻找matched pair (无内容)
-
HunHunSheng
(0 bytes)
2008-01-30, 11:19:33
(201534)
这些在很多IDE里面都不是问题,你可以自定义code style (无内容)
-
conner
(0 bytes)
2008-01-30, 11:23:59
(201539)
No。}上面肯定是缩行;再上面不缩行的那一行对应的就是开始。 (无内容)
-
Amsel
(0 bytes)
2008-01-30, 11:22:54
(201538)
加跟贴
笔名:
密码:
注册笔名请按这里
标题:
内容: (
BBCode使用说明
)