高质量C编程指南.pdf

时间:2014-01-29 09:09:02
【文件属性】:

文件名称:高质量C编程指南.pdf

文件大小:323KB

文件格式:PDF

更新时间:2014-01-29 09:09:02

C C的使用 C语言

目录 前 言 ......................................................................................................................................6 第1 章文件结构....................................................................................................................8 1.1 版权和版本的声明........................................................................................................8 1.2 头文件的结构...............................................................................................................8 1.3 定义文件的结构...........................................................................................................8 1.4 头文件的作用...............................................................................................................8 1.5 目录结构.......................................................................................................................8 第2 章程序的版式................................................................................................................8 2.1 空行 ...............................................................................................................................8 2.2 代码行...........................................................................................................................8 2.3 代码行内的空格...........................................................................................................8 2.4 对齐 ...............................................................................................................................8 2.5 长行拆分.......................................................................................................................8 2.6 修饰符的位置...............................................................................................................8 2.7 注释 ...............................................................................................................................8 2.8 类的版式.......................................................................................................................8 第3 章命名规则....................................................................................................................8 3.1 共性规则.......................................................................................................................8 3.2 简单的 WINDOWS 应用程序命名规则.........................................................................8 3.3 简单的 UNIX 应用程序命名规则..................................................................................8 第4 章表达式和基本语句....................................................................................................8 4.1 运算符的优先级...........................................................................................................8 4.2 复合表达式...................................................................................................................8 4.3 IF 语句...........................................................................................................................8 4.4 循环语句的效率...........................................................................................................8 4.5 FOR 语句的循环控制变量............................................................................................8 4.6 SWITCH 语句..................................................................................................................8 4.7 GOTO 语句......................................................................................................................8 第5 章常量............................................................................................................................8 5.1 为什么需要常量...........................................................................................................8 5.2 CONST 与#DEFINE 的比较...........................................................................................8 5.3 常量定义规则...............................................................................................................8 5.4 类中的常量...................................................................................................................8 第6 章函数设计....................................................................................................................8 高质量C++/C 编程指南,v 1.0 2001 Page 4 of 101 6.1 参数的规则...................................................................................................................8 6.2 返回值的规则...............................................................................................................8 6.3 函数内部实现的规则....................................................................................................8 6.4 其它建议.......................................................................................................................8 6.5 使用断言.......................................................................................................................8 6.6 引用与指针的比较........................................................................................................8 第7 章内存管理....................................................................................................................8 7.1 内存分配方式................................................................................................................8 7.2 常见的内存错误及其对策.............................................................................................8 7.3 指针与数组的对比........................................................................................................8 7.4 指针参数是如何传递内存的?.....................................................................................8 7.5 FREE 和DELETE 把指针怎么啦?.................................................................................8 7.6 动态内存会被自动释放吗? ........................................................................................8 7.7 杜绝“野指针” ...........................................................................................................8 7.8 有了 MALLOC/FREE 为什么还要NEW/DELETE ?.......................................................8 7.9 内存耗尽怎么办?........................................................................................................8 7.10 MALLOC/FREE 的使用要点.........................................................................................8 7.11 NEW/DELETE 的使用要点...........................................................................................8 7.12 一些心得体会.............................................................................................................8 第8 章 C++函数的高级特性.................................................................................................8 8.1 函数重载的概念...........................................................................................................8 8.2 成员函数的重载、覆盖与隐藏....................................................................................8 8.3 参数的缺省值...............................................................................................................8 8.4 运算符重载...................................................................................................................8 8.5 函数内联.......................................................................................................................8 8.6 一些心得体会...............................................................................................................8 第9 章类的构造函数、析构函数与赋值函数.....................................................................8 9.1 构造函数与析构函数的起源........................................................................................8 9.2 构造函数的初始化表....................................................................................................8 9.3 构造和析构的次序........................................................................................................8 9.4 示例:类STRING 的构造函数与析构函数..................................................................8 9.5 不要轻视拷贝构造函数与赋值函数............................................................................8 9.6 示例:类STRING 的拷贝构造函数与赋值函数..........................................................8 9.7 偷懒的办法处理拷贝构造函数与赋值函数.................................................................8 9.8 如何在派生类中实现类的基本函数............................................................................8 9.9 一些心得体会...............................................................................................................8 第10 章类的继承与组合......................................................................................................8 高质量C++/C 编程指南,v 1.0 2001 Page 5 of 101 10.1 继承 .............................................................................................................................8 10.2 组合 .............................................................................................................................8 第11 章其它编程经验..........................................................................................................8 11.1 使用 CONST 提高函数的健壮性..................................................................................8 11.2 提高程序的效率..........................................................................................................8 11.3 一些有益的建议..........................................................................................................8 参考文献................................................................................................................................8 附录A :C++/C 代码审查表................................................................................................8 附录B :C++/C 试题............................................................................................................8 附录C :C++/C 试题的答案与评分标准.............................................................................8


网友评论