• 10712阅读
  • 7回复

关于Qt程序的编码规范 [复制链接]

上一主题 下一主题
离线woshiwo
 
只看楼主 正序阅读 楼主  发表于: 2010-02-05
大家有没有关于QT程序编写的代码规范啊,在网上没有找到

有知道这方面的请指导一下

有这方面的文档么?

离线zhlgh603

只看该作者 7楼 发表于: 2010-12-06
也可以参考WebKit的:
http://webkit.org/coding/coding-style.html
离线0354030w

只看该作者 6楼 发表于: 2010-12-05
万能的dbzhang800!收藏!不过还是习惯
if()
{
code..
}
这样的格式!
离线loaden
只看该作者 5楼 发表于: 2010-12-05
//it is easier to find missing curly bracket in the following way
在多个括号嵌套的情况下,你还确信能轻易做到这一 点么?
通过编辑器的括号匹配(高亮),可以方便的实现。
所以,这不是理由。

相反,我觉得
if
{
}
多浪费了一行空间,这看起来代码比较松散,在阅读代码时更如此。


if {
}
比较紧凑。

同样,如果if后只有一行,则完全没必要加上
{
}
根本就是多此一举!

离线steinlee

只看该作者 4楼 发表于: 2010-02-09
not very good.

for example
   do not use
   if (foo) {
   }

//it is easier to find missing curly bracket in the following way
   if ( foo )
   {
   }

Always use curly bracket for if and for loop
  do not do this
   if ( something )
      a = b;

  instead
    if ( something )
    {
       a =b;
    }

the reason is that people may  want to add things to if or for loop and make stupid mistakes like
   if ( something )
      a = b;
      c = d;

the right one is
   if ( something )
   {
      a = b;
      c = d;
   }

Try code standard in google.com

Enforce code standard use in your group and company
make the code look like the same for all developers.
Developers are not allowed to use their coding styles.
All should use the same style whether they like or not.
The purpose of doing this is to reduce maintenance cost and save money.
[ 此帖被steinlee在2010-02-09 01:00重新编辑 ]
Looking for remote C/C++ and Qt 兼职
离线naohbbq
只看该作者 3楼 发表于: 2010-02-07
正好需要,非常感谢~~~
离线woshiwo
只看该作者 2楼 发表于: 2010-02-05
万分感谢
离线dbzhang800

只看该作者 1楼 发表于: 2010-02-05
快速回复
限100 字节
 
上一个 下一个