您好,欢迎光临本网站![请登录][注册会员]  
文件名称: google c++代码规范
  所属分类: C++
  开发工具:
  文件大小: 516kb
  下载次数: 0
  上传时间: 2011-04-01
  提 供 者: very****
 详细说明: Google C++ 编程规范 目录 一、头文件........................................................................................................................................4 1. #define的保护....................................................................................................................... 4 2. 头文件依赖.......................................................................................................................... 4 3. 内联函数................................................................................................. ............................. 5 4. -inl.h文件.......................................................................................................................... 5 5. 函数参数顺序(Function Parameter Ordering)............................................5 6. 包含文件的名称及次序......................................................................................................6 二、作用域........................................................................................................................................7 1. 命名空间(Namespaces)..........................................................................................7 2. 嵌套类(Nested Class)............................................................................................. 9 3. 非成员函数(Nonmember)、静态成员函数(Static Member)和全局函 数(Global Functions)...................................................................................................9 4. 局部变量(Local Variables)..................................................................................10 5. 全局变量(Global Variables)............................................................................... 10 三、类..............................................................................................................................................11 1. 构造函数(Constructor)的职责..............................................................................11 2. 默认构造函数(Default Constructors)............................................................. 12 3. 明确的构造函数(Explicit Constructors).........................................................12 4. 拷贝构造函数(Copy Constructors)...................................................................13 5. 结构体和类(Structs vs. Classes)......................................................................14 6. 继承(Inheritance)..................................................................................................14 7. 多重继承(Multiple Inheritance)...................................................................... 15 8. 接口(Interface)....................................................................................................... 15 9. 操作符重载(Operator Overloading)...............................................................16 10. 存取控制(Access Control)................................................................................16 11. 声明次序(Declaration Order).........................................................................17 12. 编写短小函数(Write Short Functions)........................................................17 四、Google特有的风情................................................................................................................. 18 1. 智能指针(Smart Pointers).................................................................................. 18 五、其他C++特性..........................................................................................................................19 1. 引用参数(Reference Arguments)...................................................................19 2. 函数重载(Function Overloading)....................................................................19 3. 缺省参数(Default Arguments)......................................................................... 20 4. 变长数组和alloca(Variable-Length Arrays and alloca())................ 20 5. 友元(Friends)............................................................................................................20 6. 异常(Exceptions)....................................................................................................20 7. 运行时类型识别(Run-Time Type Information, RTTI)........................... 22 8. 类型转换(Casting)................................................................................................... 22 9. 流(Streams)..............................................................................................................23 10. 前置自增和自减(Preincrement and Predecrement)............................24 11. const的使用(Use of const).............................................................................24 12. 整型(Integer Types)..........................................................................................25 13. 64位下的可移植性(64-bit Portability)........................................................ 26 14. 预处理宏(Preprocessor Macros)..................................................................27 15. 0和NULL(0 and NULL)....................................................................................27 16. sizeof(sizeof)........................................................................................................28 17. Boost库(Boost)................................................................................................... 28 六、命名约定..................................................................................................................................29 1. 通用命名规则(General Naming Rules)..........................................................29 2. 文件命名(File Names)........................................................................................... 30 3. 类型命名(Type Names).........................................................................................31 4. 变量命名(Variable Names).................................................................................31 5. 常量命名(Constant Names)............................................................................... 31 6. 函数命名(Function Names)................................................................................32 7. 命名空间(Namespace Names)......................................................................... 32 8. 枚举命名(Enumerator Names).........................................................................32 9. 宏命名(Macro Names)..........................................................................................33 10. 命名规则例外(Exceptions to Naming Rules)..........................................33 七、注释..........................................................................................................................................34 1. 注释风格(Comment Style)..................................................................................34 2. 文件注释(File Comments)...................................................................................34 3. 类注释(Class Comments)...................................................................................34 4. 函数注释(Function Comments)....................................................................... 35 5. 变量注释(Variable Comments)........................................................................36 6. 实现注释(Implementation Comments)...................................................... 37 7. 标点、拼写和语法(Punctuation, Spelling and Grammar)................... 38 8. TODO注释(TODO Comments).........................................................................38 八、格式..........................................................................................................................................39 1. 行长度(Line Length)..............................................................................................39 2. 非ASCII字符(Non-ASCII Characters)..........................................................40 3. 空格还是制表位(Spaces vs. Tabs).................................................................... 40 4. 函数声明与定义(Function Declarations and Definitions)...................40 5. 函数调用(Function Calls).................................................................................... 42 6. 条件语句(Conditionals)........................................................................................43 7. 循环和开关选择语句(Loops and Switch Statements).............................44 8. 指针和引用表达式(Pointers and Reference Expressions)...................45 9. 布尔表达式(Boolean Expressions)................................................................. 46 10. 函数返回值(Return Values)............................................................................. 46 11. 变量及数组初始化(Variable and Array Initialization)........................ 46 12. 预处理指令(Preprocessor Directives)....................................................... 46 13. 类格式(Class Format)........................................................................................47 14. 初始化列表(Initializer Lists)...........................................................................48 ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: google c++ 代码规范
 输入关键字,在本站1000多万海量源码库中尽情搜索: