52ky 发表于 2022-9-22 17:13:38

高质量C++编程指南(林锐)

目录前语...6第1章文件结构...111.1版权和版本的声明...111.2头文件的结构...121.3定义文件的结构...131.4头文件的效果...131.5目录结构...14第2章程序的版式...152.1空行...152.2代码行...162.3代码行内的空格...172.4对齐...182.5长行拆分...192.6修饰符的方位...192.7注释...202.8类的版式...21第3章命名规则...223.1共性规则...223.2简单的Windows使用程序命名规则...233.3简单的Unix使用程序命名规则...25第4章表达式和基本句子...264.1运算符的优先级...264.2复合表达式...274.3if句子...274.4循环句子的效率...294.5for句子的循环控制变量...304.6switch句子...304.7goto句子...31第5章常量...335.1为何需求常量...335.2const与#define的比照...335.3常量定义规则...335.4类中的常量...34第6章函数设计...366.1参数的规则...366.2返回值的规则...376.3函数内部实现的规则...396.4其它建议...406.5使用断语...416.6引证与指针的比照...42第7章内存管理...447.1内存分配方法...447.2常见的内存错误及其对策...447.3指针与数组的比照...457.4指针参数是如何传递内存的?...477.5free和delete把指针如何啦?...507.6动态内存会被自动释放吗?...507.7根绝“野指针”...517.8有了malloc/free为何还要new/delete?...527.9内存耗尽如何办?...537.10malloc/free的使用关键...547.11new/delete的使用关键...557.12一些心得体会...56第8章C++函数的高档特性...578.1函数重载的概念...578.2成员函数的重载、覆盖与隐藏...608.3参数的缺值...638.4运算符重载...648.5函数内联...658.6一些心得体会...68第9章类的结构函数、析构函数与赋值函数...699.1结构函数与析构函数的起源...699.2结构函数的初始化表...709.3结构和析构的秩序...729.4示例:类String的结构函数与析构函数...729.5不要小看复制结构函数与赋值函数...739.6示例:类String的复制结构函数与赋值函数...739.7偷闲的方法管理复制结构函数与赋值函数...759.8如何在派生类中实现类的基本函数...759.9一些心得体会...77第10章类的承继与组合...7810.1承继...7810.2组合...80第11章其它编程经验...8211.1使用const提升函数的健壮性...8211.2提升程序的效率...8411.3一些有益的建议...85参考文献...87附录A:C++/C代码审查表...88附录B:C++/C试题...93附录C:C++/C试题的答案与评分标准...97
高质量C++编程指南.doc

(Contents Preamble...6 Chapter 1 File Structure...111.1 Copyright and Version Notices...111.2 Structure of Header Files...121.3 Structure of Definition Files...131.4 Effects of Header Files...131.5 Directories Structure...14 Chapter 2 Layout of Programs...152.1 Blank Lines...152.2 Code Lines...162.3 Spaces within Code Lines...172.4 Alignment...182.5 Long Line Splitting...192.6 Modifiers Orientation... 192.7 Notes... 202.8 Layout of Classes... 21 Chapter 3 Naming Rules... 223.1 Common Rules... 223.2 Simple Windows Using Program Naming Rules... 233.3 Simple Unix Using Program Naming Rules...25 Chapter 4 Expressions and Basic Sentences...264.1 Precedence of Operators...264.2 Compound Expressions...274.3 If Sentences...274.4 Efficiency of Looping Sentences...294.5 For Sentences Loop control variables... 304.6 switch sentences... 304.7 goto sentences... 31 Chapter 5 constants... 335.1 Why constants are needed... 335.2 Contrast between const and #define... 335.3 Constant definition rules... 335.4 Constants in Classes...34 Chapter 6 Function Design...366.1 Rules for Parameters...366.2 Rules for Return Values...376.3 Rules for Internal Implementation of Functions...396.4 Other Recommendations...406.5 Using Assertion ...416.6 Comparison of Citations and Pointers...42 Chapter 7 Memory Management...447.1 Memory Allocation Methods...447.2 Common Memory Errors and Their Countermeasures...447.3 Comparison of Pointers and Arrays...457.4 Pointers How do parameters pass memory?...477.5 What about free and delete pointers?...507.6 Will dynamic memory be automatically released? Still need new/delete?...527.9 How to deal with memory exhaustion?...537.10 The key to using malloc/free...547.11 The key to using new/delete...557.12 Some experiences...56 Chapter 8 Advanced features of C   functions... 578.1 The concept of function overloading... 578.2 Overloading, overriding and hiding of member functions... 608.3 Missing values ??of parameters... 638.4 Operator overloading... 648.5 Function inlining... .658.6 Some experiences... 68 Chapter 9 Class structure functions, destructors and assignment functions... 699.1 The origin of structure functions and destructors... 699.2 The initialization table of structure functions... 709.3 Structure and Destructive order ...729.4 Example: Structure function and destructor of class String...729.5 Don't underestimate copy structure function and assignment function...739.6 Example: Copy structure function and assignment function of class String...739.7 Ways to get away Managing copy structure functions and assignment functions... 759.8 How to implement the basic functions of a class in a derived class... 759.9 Some experiences... 77 Chapter 10 Inheritance and composition of classes... 7810.1 Inheritance... 7810.2 Composition ...80 Chapter 11 Other Programming Experiences...8211.1 Using const to Improve the Robustness of Functions...8211.2 Improving Program Efficiency...8411.3 Some Helpful Suggestions...85 References...87 Appendix A: C/C Code Review Form...88 Appendix B: C/C Test Questions...93 Appendix C: Answers and Grading Standards for C/C Test Questions...97
High Quality C   Programming Guide.doc)




页: [1]
查看完整版本: 高质量C++编程指南(林锐)