煮饺子的锅

为了那些爱你的人,和那些你爱的人。 无论你多努力都不为过!
    <<  gentoo ebuild FUQ :-) | 首 页 | 意志?坚强  >>
  • C and C++ Style Guides

    2008-05-31

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://cbkid.blogbus.com/logs/21984813.html

    http://www.chris-lott.org/resources/cstyle/

    Linus Torvalds:
    1.制表符8位。 

    2.大括号:

    if (x is true) {
    we do y
    }
    int function(int x)
    {
    body of function
    }
    do {
    body of do-loop
    } while (condition);
    if (x == y) {
    ..
    } else if (x > y) {
    ...
    } else {
    ....
    }
     
    3.变量名:全局要用有意义的(count_active_users()" or similar, you should _not_ call it "cntusr()". 
     局部变量要简短比如(i,tmp)
     
    4 .函数:
    函数应该简短干练。且局部变量应该少于十个。 
    5.注释:Generally, you want your comments to tell WHAT your code does, not HOW. 
    Also, try to avoid putting comments inside a function body ,
    put the comments at the head
    of the function, telling people what it does, and possibly WHY it does
    it.
    。。。 

     

     


    随机文章:

    在 Vim 上使用 Slippery Snippet ( Textmate-Like ) 2008-06-06
    bop系列 2009-03-13
    使用gvim作python的编辑器 2009-03-08
    献给在机房上网的朋友们 2008-10-07
    李纳斯大神的十句名言 2008-06-09

    收藏到:Del.icio.us




    分类: 信息&技术 | Tag: cc++
    引用地址:
    cbkid 发表于10:31:31 | 编辑 | 继续话题 | 转发 | 分享 0

个人资料

cbkid

最新日志

  • 死亡笔记 pass
  • 中国FreeBSD精英DelphiJ的一段话
  • arch vs ubuntu
  • 关于从arch到ubuntu
  • bop系列
  • 认识 GCC 4
  • 懒惰的Linux管理员
  • Python 3 初探,第 1 部分: Python 3 的新特
  • 强大的ibm
  • 使用gvim作python的编辑器
全部日志>>

存档

  • 2009-03[13]
  • 2009-02[12]
  • 2008 [64]
  • 2007 [13]

搜索

最新评论

  • 宇:哈哈,因为生活很有激情的阿~...
  • RSS 什么是RSS?
    用IM提醒我内容更新
    订阅到QQ邮箱
    订阅到鲜果阅读器
    订阅到Google阅读器
    订阅到抓虾阅读器
  • 《城客》第四期:创意之城
    博客大巴
    博客大巴使用指南
    博客大巴模板中心
    免费注册博客大巴
    一键博客搬家工具
    中文互动杂志城客
Copyright © 2002-2009 BlogBus.com, All Rights Reserved. 博客大巴 版权所有
博客大巴模板设计: 富贵有余 | 作者:陈小新