C++Primer4中文高清版【有目录+高清+可搜索+可编辑/复制/粘贴+无密码】
一、下载须知
.........................有目录
.........................已经进行解密处理,大多数PDF会进行加密以至于无法编辑
.........................高清
.........................可直接复制粘贴源码
.........................可搜索某一段内容
.........................本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。
二、全部目录如下:
目录
前言 ..................................................................................................................................................1
第四版的改动...........................................................................................................................2
本书结构...................................................................................................................................3
致谢...........................................................................................................................................4
第一章快速入门...........................................................................................................................17
1.1. 编写简单的 C++ 程序..........................................................................................17
调用 GNU 或微软编译器....................................................................................................20
Exercises Section 1.1.1 ...........................................................................................................21
1.2. 初窥输入/输出........................................................................................................21
关键概念:已初始化变量和未初始化变量.........................................................................26
Exercises Section 1.2.2 ...........................................................................................................27
1.3. 关于注释.................................................................................................................27
Exercises Section 1.3 ......................................................................................................29
1.4. 控制结构.................................................................................................................29
关键概念:C++ 程序的缩排和格式....................................................................................31
再谈编译.................................................................................................................................34
Exercises Section 1.4.2 ...........................................................................................................35
Exercises Section 1.4.3 ...........................................................................................................37
从键盘输入文件结束符.........................................................................................................39
Exercises Section 1.4.4 ...........................................................................................................39
1.5. 类的简介.................................................................................................................39
关键概念:类定义行为.........................................................................................................42
Exercises Section 1.5.1 ...........................................................................................................43
Exercises Section 1.5.2 ...........................................................................................................45
1.6. C++ 程序................................................................................................................45
Exercises Section 1.6 ..............................................................................................................47
小结.................................................................................................................................47
术语.................................................................................................................................47
第一部分基本语言.......................................................................................................................54
第二章变量和基本类型.......................................................................................................55
2.1. 基本内置类型.........................................................................................................55
内置类型的机器级表示.........................................................................................................57
建议:使用内置算术类型.....................................................................................................60
Exercises Section 2.1.2 ...........................................................................................................61
2.2. 字面值常量.............................................................................................................61
建议:不要依赖未定义行为.................................................................................................66
Exercises Section 2.2 ..............................................................................................................67
2.3. 变量.........................................................................................................................67
Exercises Section 2.3 ..............................................................................................................68
关键概念:强静态类型.........................................................................................................69
Exercises Section 2.3.1 ...........................................................................................................70
6
术语:什么是对象?.............................................................................................................71
Exercises Section 2.3.2 ...........................................................................................................73
Exercises Section 2.3.3 ...........................................................................................................77
警告:未初始化的变量引起运行问题.................................................................................78
Exercises Section 2.3.4 ...........................................................................................................79
Exercises Section 2.3.5 ...........................................................................................................81
Exercises Section 2.3.6 ...........................................................................................................84
2.4. const 限定符...........................................................................................................84
Exercises Section 2.4 ..............................................................................................................87
2.5. 引用.........................................................................................................................87
术语:const 引用是指向 const 的引用...........................................................................89
Exercises Section 2.5 ..............................................................................................................90
2.6. typedef 名字............................................................................................................90
2.7. 枚举.........................................................................................................................91
2.8. 类类型.....................................................................................................................93
Exercises Section 2.8 ..............................................................................................................97
2.9. 编写自己的头文件.................................................................................................97
编译和链接多个源文件.........................................................................................................99
Exercises Section 2.9.1 .........................................................................................................102
小结...............................................................................................................................104
术语...............................................................................................................................105
第三章标准库类型.............................................................................................................112
3.1. 命名空间的 using 声明........................................................................................112
Exercises Section 3.1 ............................................................................................................115
3.2. 标准库 string 类型................................................................................................115
警告:标准库string 类型和字符串字面值.....................................................................116
Exercises Section 3.2.1 .........................................................................................................116
Exercises Section 3.2.2 .........................................................................................................119
建议:采用 C 标准库头文件的 C++ 版本.........................................................................127
Exercises Section 3.2.4 .........................................................................................................127
3.3. 标准库 vector 类型.............................................................................................127
关键概念:vector 对象动态增长.....................................................................................130
Exercises Section 3.3.1 .........................................................................................................131
关键概念:安全的泛型编程...............................................................................................134
警告:仅能对确知已存在的元素进行下标操作...............................................................135
Exercises Section 3.3.2 .........................................................................................................136
3.4. 迭代器简介...........................................................................................................136
术语:迭代器和迭代器类型...............................................................................................137
Exercises Section 3.4 ............................................................................................................142
Exercises Section 3.4.1 .........................................................................................................143
3.5. 标准库 bitset .........................................................................................................143
Exercises Section 3.5.2 .........................................................................................................150
小结...............................................................................................................................150
术语...............................................................................................................................150
7
第四章数组和指针.............................................................................................................155
4.1. 数组.......................................................................................................................155
警告:数组的长度是固定的...............................................................................................159
Exercises Section 4.1.1 .........................................................................................................160
Exercises Section 4.1.2 .........................................................................................................162
4.2. 指针的引入...........................................................................................................162
建议:尽量避免使用指针和数组.......................................................................................163
Exercises Section 4.2.2 .........................................................................................................169
关键概念:给指针赋值或通过指针进行赋值...................................................................170
Exercises Section 4.2.3 .........................................................................................................172
Exercises Section 4.2.4 .........................................................................................................177
建议:理解复杂的const 类型的声明.............................................................................180
Exercises Section 4.3 ............................................................................................................182
4.3. C 风格字符串.......................................................................................................182
Exercises Section 4.3 ............................................................................................................188
C 风格字符串与 C++ 的标准库类型string 的比较...................................................192
Exercises Section 4.3.1 .........................................................................................................194
Exercises Section 4.3.2 .........................................................................................................196
4.4. 多维数组...............................................................................................................196
Exercises Section 4.4.1 .........................................................................................................200
小结...............................................................................................................................200
术语...............................................................................................................................200
第五章表达式.....................................................................................................................204
5.1. 算术操作符...........................................................................................................205
警告:溢出和其他算术异常...............................................................................................207
Exercises Section 5.1 ............................................................................................................209
5.2. 关系操作符和逻辑操作符...................................................................................209
Exercises Section 5.2 ............................................................................................................213
5.3. 位操作符...............................................................................................................213
Exercises Section 5.3.1 .........................................................................................................217
5.4. 赋值操作符...........................................................................................................218
Exercises Section 5.4.2 .........................................................................................................221
Exercises Section 5.4.3 .........................................................................................................222
5.5. 自增和自减操作符...............................................................................................222
建议:只有在必要时才使用后置操作符...........................................................................223
建议:简洁即是美...............................................................................................................224
Exercises Section 5.5 ............................................................................................................225
5.6. 箭头操作符...........................................................................................................225
Exercises Section 5.6 ............................................................................................................226
5.7. 条件操作符...........................................................................................................226
Exercises Section 5.7 ............................................................................................................228
5.8. sizeof 操作符........................................................................................................228
Exercises Section 5.8 ............................................................................................................229
5.9. 逗号操作符...........................................................................................................229
8
Exercises Section 5.9 ............................................................................................................230
5.10. 复合表达式的求值.............................................................................................230
Exercises Section 5.10.2 .......................................................................................................236
建议:复合表达式的处理...................................................................................................238
Exercises Section 5.10.3 .......................................................................................................239
5.11. new 和 delete 表达式........................................................................................239
警告:动态内存的管理容易出错.......................................................................................243
Exercises Section 5.11 ..........................................................................................................244
5.12. 类型转换.............................................................................................................244
Exercises Section 5.12.3 .......................................................................................................250
建议:避免使用强制类型转换...........................................................................................253
Exercises Section 5.12.7 .......................................................................................................255
小结...............................................................................................................................255
术语...............................................................................................................................256
第六章语句.........................................................................................................................261
6.1. 简单语句...............................................................................................................261
6.2. 声明语句...............................................................................................................262
6.3. 复合语句(块)...................................................................................................263
Exercises Section 6.3 ............................................................................................................264
6.4. 语句作用域.........................................................................................................264
6.5. if 语句...................................................................................................................265
Exercises Section 6.5.1 .........................................................................................................270
6.6. switch 语句...........................................................................................................270
Exercises Section 6.6.5 .........................................................................................................278
Code for Exercises in Section 6.6.5 ......................................................................................278
6.7. while 语句.............................................................................................................279
Exercises Section 6.7 ............................................................................................................282
6.8. for 循环语句.........................................................................................................282
Exercises Section 6.8.2 .........................................................................................................286
6.9. do while 语句........................................................................................................286
Exercises Section 6.9 ............................................................................................................289
6.10. break 语句...........................................................................................................289
Exercises Section 6.10 ..........................................................................................................291
6.11. continue 语句......................................................................................................291
Exercises Section 6.11 ..........................................................................................................292
6.12. goto 语句.............................................................................................................292
Exercises Section 6.12 ..........................................................................................................293
6.13. try 块和异常处理...............................................................................................293
Exercises Section 6.13.2 .......................................................................................................297
6.14. 使用预处理器进行调试.....................................................................................299
Exercises Section 6.14 ..........................................................................................................301
小结...............................................................................................................................301
术语...............................................................................................................................302
第七章函数.........................................................................................................................306
9
7.1. 函数的定义...........................................................................................................306
Exercises Section 7.1.2 .........................................................................................................311
7.2. 参数传递...............................................................................................................311
Exercises Section 7.2.1 .........................................................................................................314
Exercises Section 7.2.2 .........................................................................................................321
Exercises Section 7.2.5 .........................................................................................................328
Exercises Section 7.2.6 .........................................................................................................329
7.3. return 语句............................................................................................................330
Exercises Section 7.3.2 .........................................................................................................337
Exercises Section 7.3.3 .........................................................................................................339
7.4. 函数声明...............................................................................................................339
Exercises Section 7.4 ............................................................................................................341
Exercises Section 7.4.1 .........................................................................................................344
7.5. 局部对象...............................................................................................................344
Exercises Section 7.5.2 .........................................................................................................346
7.6. 内联函数...............................................................................................................346
Exercises Section 7.6 ............................................................................................................348
7.7. 类的成员函数.......................................................................................................348
Exercises Section 7.7.4 .........................................................................................................356
7.8. 重载函数...............................................................................................................356
建议:何时不重载函数名...................................................................................................359
Exercises Section 7.8.1 .........................................................................................................362
Exercises Section 7.8.3 .........................................................................................................366
Exercises Section 7.8.4 .........................................................................................................370
7.9. 指向函数的指针...................................................................................................370
小结...............................................................................................................................374
术语...............................................................................................................................375
第八章标准 IO 库............................................................................................................379
8.1. 面向对象的标准库...............................................................................................379
Exercises Section 8.1 ............................................................................................................383
8.2. 条件状态...............................................................................................................383
Exercises Section 8.2 ............................................................................................................387
8.3. 输出缓冲区的管理...............................................................................................387
警告:如果程序崩溃了,则不会刷新缓冲区...................................................................388
8.4. 文件的输入和输出...............................................................................................389
警告:C++ 中的文件名......................................................................................................391
Exercises Section 8.4.1 .........................................................................................................394
Exercises Section 8.4.3 .........................................................................................................398
8.5. 字符串流...............................................................................................................398
Exercises Section 8.5 ............................................................................................................401
小结...............................................................................................................................401
术语...............................................................................................................................401
第二部分:容器和算法...............................................................................................................403
第九章. 顺序容器................................................................................................................404
10
9.1. 顺序容器的定义...................................................................................................405
Exercises Section 9.1.1 .........................................................................................................409
Exercises Section 9.1.2 .........................................................................................................411
9.2. 迭代器和迭代器范围...........................................................................................411
Exercises Section 9.2 ............................................................................................................414
对形成迭代器范围的迭代器的要求...................................................................................415
Exercises Section 9.2.1 .........................................................................................................417
9.3. 每种顺序容器都提供了一组有用的类型定义以及以下操作: .......................418
Exercises Section 9.3.1 .........................................................................................................419
关键概念:容器元素都是副本...........................................................................................421
Exercises Section 9.3.3 .........................................................................................................425
Exercises Section 9.3.4 .........................................................................................................427
Exercises Section 9.3.5 .........................................................................................................429
Exercises Section 9.3.6 .........................................................................................................431
Exercises Section 9.3.7 .........................................................................................................434
Exercises Section 9.3.8 .........................................................................................................437
9.4. vector 容器的自增长............................................................................................437
Exercises Section 9.4.1 .........................................................................................................441
9.5. 容器的选用...........................................................................................................441
Exercises Section 9.5 ............................................................................................................444
9.6. 再谈 string 类型.............................................................................................444
Exercises Section 9.6 ....................................................................................................446
Exercises Section 9.6.4 ................................................................................................456
9.7. 容器适配器.........................................................................................................459
Exercises Section 9.7.2 ................................................................................................463
小结...............................................................................................................................463
术语...............................................................................................................................463
第十章 关联容器.................................................................................................................466
10.1. 引言:pair 类型.............................................................................................466
Exercises Section 10.1 ..................................................................................................469
10.2. 关联容器...........................................................................................................469
Exercises Section 10.2 ..................................................................................................470
10.3. map 类型...........................................................................................................470
Exercises Section 10.3.1 ..............................................................................................472
Exercises Section 10.3.2 ..............................................................................................473
Exercises Section 10.3.4 ..............................................................................................475
Exercises Section 10.3.5 ..............................................................................................479
Exercises Section 10.3.6 ..............................................................................................480
Exercises Section 10.3.9 ..............................................................................................485
10.4. set 类型...........................................................................................................485
Exercises Section 10.4 ..................................................................................................486
Exercises Section 10.4.2 ..............................................................................................489
10.5. multimap 和 multiset 类型........................................................................490
Exercises Section 10.5.2 ..............................................................................................494
11
10.6. 容器的综合应用:文本查询程序...................................................................495
Exercises Section 10.6.2 ..............................................................................................498
Exercises Section 10.6.3 ..............................................................................................501
Exercises Section 10.6.4 ..............................................................................................503
小结...............................................................................................................................503
术语...............................................................................................................................504
第十一章 泛型算法.............................................................................................................506
11.1. 概述...................................................................................................................506
Exercises Section 11.1 ..................................................................................................509
关键概念:算法永不执行容器提供的操作.......................................................................509
11.2. 初窥算法...........................................................................................................510
关键概念:迭代器实参类型...............................................................................................512
Exercises Section 11.2.1 ..............................................................................................512
Exercises Section 11.2.2 ..............................................................................................515
Exercises Section 11.2.3 ..............................................................................................521
11.3. 再谈迭代器.......................................................................................................521
Exercises Section 11.3.1 ..............................................................................................523
Exercises Section 11.3.2 ..............................................................................................529
Exercises Section 11.3.3 ..............................................................................................532
关键概念:关联容器与算法...............................................................................................534
Exercises Section 11.3.5 ..............................................................................................535
11.4. 泛型算法的结构...............................................................................................536
Exercises Section 11.4.2 ..............................................................................................539
11.5. 容器特有的算法...............................................................................................539
Exercises Section 11.5 ..................................................................................................541
小结...............................................................................................................................541
术语...............................................................................................................................542
第三部分:类和数据抽象...........................................................................................................545
第十二章 类.........................................................................................................................546
12.1. 类的定义和声明...............................................................................................546
Exercises Section 12.1.1 ..............................................................................................548
建议:具体类型和抽象类型...............................................................................................549
关键概念:数据抽象和封装的好处...................................................................................551
Exercises Section 12.1.2 ..............................................................................................551
Exercises Section 12.1.3 ..............................................................................................555
Exercises Section 12.1.4 ..............................................................................................557
12.2. 隐含的 this 指针...........................................................................................558
建议:用于公共代码的私有实用函数...............................................................................562
Exercises Section 12.2 ..................................................................................................563
12.3. 类作用域...........................................................................................................563
Exercises Section 12.3 ..................................................................................................566
Exercises Section 12.3.1 ..............................................................................................571
12.4. 构造函数...........................................................................................................571
Exercises Section 12.4 ..................................................................................................573
12
建议:使用构造函数初始化列表.......................................................................................577
Exercises Section 12.4.1 ..............................................................................................579
Exercises Section 12.4.2 ..............................................................................................580
Exercises Section 12.4.3 ..............................................................................................583
Exercises Section 12.4.4 ..............................................................................................586
Exercises Section 12.4.5 ..............................................................................................588
12.5. 友元...................................................................................................................588
Exercises Section 12.5 ..................................................................................................591
12.6. static 类成员................................................................................................591
Exercises Section 12.6 ..................................................................................................593
Exercises Section 12.6.1 ..............................................................................................594
Exercises Section 12.6.2 ..............................................................................................597
小结...............................................................................................................................597
术语...............................................................................................................................598
第十三章 复制控制.............................................................................................................601
13.1. 复制构造函数...................................................................................................602
Exercises Section 13.1 ..................................................................................................604
Exercises Section 13.1.2 ..............................................................................................607
13.2. 赋值操作符.......................................................................................................608
Exercises Section 13.2 ..................................................................................................610
13.3. 析构函数...........................................................................................................611
Exercises Section 13.3 ..................................................................................................613
13.4. 消息处理示例...................................................................................................614
Exercises Section 13.4 ..................................................................................................620
13.5. 管理指针成员...................................................................................................620
Exercises Section 13.5 ..................................................................................................623
建议:管理指针成员...........................................................................................................628
Exercises Section 13.5.1 ..............................................................................................629
Exercises Section 13.5.2 ..............................................................................................631
小结...............................................................................................................................632
术语...............................................................................................................................632
第十四章 重载操作符与转换.............................................................................................635
14.1. 重载操作符的定义.............................................................................................635
习题 14.1..............................................................................................................................640
警告:审慎使用操作符重载...............................................................................................642
Exercises Section 14.1.1 .......................................................................................................643
14.2. 输入和输出操作符.............................................................................................643
Exercises Section 14.2.1 .......................................................................................................646
Exercises Section 14.2.2 ..............................................................................................649
14.3. 算术操作符和关系操作符.................................................................................649
Exercises Section 14.3 ..........................................................................................................651
14.4. 赋值操作符.........................................................................................................652
Exercises Section 14.4 ..........................................................................................................654
14.5. 下标操作符.........................................................................................................654
13
Exercises Section 14.5 ..........................................................................................................656
14.6. 成员访问操作符.................................................................................................656
Exercises Section 14.6 ..........................................................................................................660
14.7. 自增操作符和自减操作符.................................................................................660
Exercises Section 14.7 ..........................................................................................................665
14.8. 调用操作符和函数对象.....................................................................................665
Exercises Section 14.8 ..........................................................................................................666
Exercises Section 14.8.1 .......................................................................................................669
Exercises Section 14.8.3 ..............................................................................................672
14.9. 转换与类类型.....................................................................................................673
Exercises Section 14.9.2 .......................................................................................................679
警告:避免转换函数的过度使用.......................................................................................684
Exercises Section 14.9.4 .......................................................................................................688
警告:转换和操作符...........................................................................................................690
Exercises Section 14.9.5 .......................................................................................................692
小结...............................................................................................................................692
术语...............................................................................................................................693
第四部分:面向对象编程与泛型编程.......................................................................................695
第十五章. 面向对象编程...................................................................................................696
15.1. 面向对象编程:概述.........................................................................................696
15.2. 定义基类和派生类.............................................................................................698
Exercises Section 15.2.1 .......................................................................................................701
关键概念:类设计与受保护成员.......................................................................................702
Exercises Section 15.2.3 .......................................................................................................707
关键概念:C++ 中的多态性..............................................................................................710
Exercises Section 15.2.4 .......................................................................................................713
关键概念:继承与组合.......................................................................................................716
Exercises Section 15.2.5 .......................................................................................................719
Exercises Section 15.2.7 .......................................................................................................721
15.3. 转换与继承.........................................................................................................721
15.4. 构造函数和复制控制.........................................................................................725
关键概念:重构...................................................................................................................729
关键概念:尊重基类接口...................................................................................................730
Exercises Section 15.4.2 .......................................................................................................731
Exercises Section 15.4.4 .......................................................................................................736
15.5. 继承情况下的类作用域.....................................................................................737
Exercises Section 15.5.1 .......................................................................................................738
Exercises Section 15.5.2 .......................................................................................................740
关键概念:名字查找与继承...............................................................................................743
Exercises Section 15.5.4 ..............................................................................................744
15.6. 纯虚函数.............................................................................................................745
Exercises Section 15.6 ..........................................................................................................746
15.7. 容器与继承.........................................................................................................746
Exercises Section 15.7 ..........................................................................................................747
14
15.8. 句柄类与继承.....................................................................................................747
Exercises Section 15.8.2 .......................................................................................................753
Exercises Section 15.8.3 .......................................................................................................758
15.9. 再谈文本查询示例.............................................................................................758
Exercises Section 15.9.2 .......................................................................................................764
Exercises Section 15.9.5 .......................................................................................................772
Exercises Section 15.9.6 .......................................................................................................774
小结...............................................................................................................................774
术语...............................................................................................................................775
第十六章 模板和泛型编程.................................................................................................778
16.1. 模板定义.............................................................................................................778
Exercises Section 16.1.1 .......................................................................................................781
Exercises Section 16.1.2 .......................................................................................................783
Exercises Section 16.1.3 .......................................................................................................786
Exercises Section 16.1.4 .......................................................................................................789
Exercises Section 16.1.5 .......................................................................................................790
Exercises Section 16.1.6 .......................................................................................................792
警告:链接时的编译时错误...............................................................................................793
16.2. 实例化.................................................................................................................793
Exercises Section 16.2.1 .......................................................................................................801
Exercises Section 16.2.2 ..............................................................................................804
16.3. 模板编译模型.....................................................................................................804
Exercises Section 16.3 ..........................................................................................................807
警告:类模板中的名字查找...............................................................................................808
16.4. 类模板成员.........................................................................................................808
Exercises Section 16.4 ..........................................................................................................813
Exercises Section 16.4.1 .......................................................................................................818
Exercises Section 16.4.2 .......................................................................................................820
Exercises Section 16.4.4 .......................................................................................................826
Exercises Section 16.4.6 .......................................................................................................832
16.5. 一个泛型句柄类.................................................................................................833
Exercises Section 16.5.1 .......................................................................................................836
Exercises Section 16.5.2 .......................................................................................................839
16.6. 模板特化.............................................................................................................839
Exercises Section 16.6.1 .......................................................................................................843
Exercises Section 16.6.2 .......................................................................................................846
Exercises Section 16.6.3 .......................................................................................................848
16.7. 重载与函数模板.................................................................................................849
Exercises Section 16.7 ..........................................................................................................853
小结...............................................................................................................................853
术语...............................................................................................................................854
第五部分 高级主题...................................................................................................................857
第十七章 用于大型程序的工具.......................................................................................858
17.1. 异常处理.............................................................................................................858
15
Exercises Section 17.1.1 .......................................................................................................862
Exercises Section 17.1.3 .......................................................................................................866
Exercises Section 17.1.5 .......................................................................................................869
Exercises Section 17.1.8 .......................................................................................................874
Exercises Section 17.1.9 .......................................................................................................881
警告:Auto_ptr 缺陷.........................................................................................................882
Exercises Section 17.1.11......................................................................................................888
17.2. 命名空间...........................................................................................................888
Exercises Section 17.2.1 ..............................................................................................894
Exercises Section 17.2.2 ..............................................................................................895
未命名的命名空间取代文件中的静态声明.......................................................................897
Exercises Section 17.2.3 ..............................................................................................897
Exercises Section 17.2.4 ..............................................................................................902
警告:避免 Using 指示.....................................................................................................903
Exercises Section 17.2.6 ..............................................................................................910
17.3. 多重继承与虚继承...........................................................................................911
Exercises Section 17.3.1 ..............................................................................................913
Exercises Section 17.3.2 ..............................................................................................915
Exercises Section 17.3.2 ..............................................................................................917
本节习题的代码...................................................................................................................920
Exercises Section 17.3.4 ..............................................................................................921
Exercises Section 17.3.6 ..............................................................................................926
Exercises Section 17.3.7 ..............................................................................................929
小结...............................................................................................................................930
术语...............................................................................................................................931
第十八章 特殊工具与技术.................................................................................................936
18.1. 优化内存分配...................................................................................................936
Exercises Section 18.1.2 ..............................................................................................942
术语对比:new 表达式与 operator new 函数..............................................................942
Exercises Section 18.1.4 ..............................................................................................945
Exercises Section 18.1.5 ..............................................................................................946
Exercises Section 18.1.6 ..............................................................................................949
Exercises Section 18.1.7 ..............................................................................................955
18.2. 运行时类型识别...............................................................................................956
Exercises Section 18.2.1 ..............................................................................................959
Exercises Section 18.2.2 ..............................................................................................961
Exercises Section 18.2.4 ..............................................................................................966
18.3. 类成员的指针...................................................................................................966
Exercises Section 18.3.1 ..............................................................................................969
Exercises Section 18.3.2 ..............................................................................................973
18.4. 嵌套类...............................................................................................................973
Exercises Section 18.4.2 ..............................................................................................979
18.5. 联合:节省空间的类.......................................................................................980
18.6. 局部类...............................................................................................................983
16
18.7. 固有的不可移植的特征...................................................................................985
对链接到 C 的预处理器支持.............................................................................................992
Exercises Section 18.7.3 ..............................................................................................994
小结...............................................................................................................................994
术语...............................................................................................................................995
附录 A. 标准库..........................................................................................................................999
A.1. 标准库名字和头文件................................................................................................1000
A.2. 算法简介..................................................................................................................1003
A.2.1. 查找对象的算法...........................................................................................1003
A.2.2. 其他只读算法...............................................................................................1005
A.2.3. 二分查找算法...............................................................................................1006
A.2.4. 写容器元素的算法.......................................................................................1006
A.2.5. 划分与排序算法...........................................................................................1008
A.2.6. 通用重新排序操作.......................................................................................1010
A.2.7. 排列算法.......................................................................................................1012
A.2.8. 有序序列的集合算法........................
C++程序设计-谭浩强
简介:umm....这是一本属于谭浩强经典的系列,谭浩强的书应该大多数人都了解过,可以作为入门看看,我自己初学编程那会也是买了纸质版的书,初学的同学可以结合慕课网上练习教程使用更佳。
Effective C++第3版中文版 侯捷译本【有目录+高清+可搜索+可编辑】
本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。 全部目录如下:
自录
Contents
译序••.••.•..•..•.••.••.•..•..•..•.•..•..•.•..•.••.•..••.•..•..•.•..••.•..••.•.•..••.••••••••••••••••••••••••••••••••.•• VII
中英简繁术语对照...........................................•......•...•.....••....•..••..•..•..•.....•.............. IX
目录••.•..•.••.••.•..••.•.•..•..•..•..•.•..•.•..•.••.••..•....•.••..•..•..•....••.••••.••.•••••••••••••••••••••.•••••. XVII
序言•••.•..•..•.•••••.•..••.•.••..•.•....•..•.•.....•..•..•.••.••.•..•..•.••..•.••....•..•••••••••••••••••••••••••••••• XXI
致谢••.•.••.••••••••••••••••••••••••••••••••.••.•.••••.•...•..•.••..•..•....••.•..•..•.•..••.•..••••••••••••••••••••. XXIII
导读...................................................................................................................... 1
1. 让自己习惯C++........................................................................................... 11
Accustoming Yourself to C++ ............................................................................ 11
条款01: 视C++ 为一个语言联邦........................................................................ 11
View C++ as a federation of languages ....... …............. …............. …......... ….... 11
条款02: 尽炽以const,enum,inline 替换#define.………………………….. 13
Prefer consts,enums and inlines to 枚lefmes. ................................................. 13
条款03: 尽可能使用const ................................................................................. 17
Use const whenever possible .......................................................................... I 7
条款04: 确定对象被使用前已先被初始化…………………………………………………. 26
Make sure that objects are initialized before they're used. ……………….. …........ 26
2. 构造/析构/赋值运算.....................................................................................34
Constructors, Destructors, and Assignment Operators …·…………………·………….34
条款05: 了解C廿默默编写并调用哪些函数.……·……...…………………………….. 34
Know what functions C++ silently writes and calls. …………... …........ ….......... 34
条款06: 若不想使用编译器自动生成的函数,就该明确拒绝……………..…...... 37
Explicitly 小sallow the use of compiler-generated functions you do not want. .. 3 7
条款07: 为多态基类声明virtual 析构函数…………….......噜....…………….. ………….. 40
Declare destructors virtual m polymorphic base classes. ……………... ………….. 40
Effective C++中文版,第三版
...
XVIII 目录
条款08: 别让异常逃离析构函数....…... ……... …………………………············ …………. 44
p revent exceptions from leaving destructors ...... 今....…………….. ….......... ……... 44
条款09: 绝不在构造和析构过程中调用virtual 函数…·…………………....…………. 48
Never call virtual functions during construction or destruction. ……·…………. .48
条款10: 令operator= 返回一个reference to *this……………………….... …. 52
Have assignment operators return a reference to *this ... …·………………·……….52
条款II : 在operator= 中处理”自我赋值” ……………………·………..…………. 53
Handle assignment to self in operato产... ........ .... ........ ........... ......................... 53
条款12: 复制对象时勿忘其每一个成分..........……………………............ ……………. 57
Copy all parts of an object. ............................................................................. 57
3. 资源管理.................... .... . .........................二.............................................. 6 1
Resource Management ........................................................................................ 61
条款13: 以对象管理资源...................................................................................... 61
Use objects to manage resources ................................... …............. ….............. 61
条款14: 在资源管理类中小心coping 行为..............…………………………... ….. ….. 66
Think carefully about copying behavior in resource-managing classes .. …….. 66
条款15: 在资源管理类中提供对原始资源的访问………………………………………. 69
Provide access to raw resources in resource-managing classes ... … …·令... ..…... 69
条款16 : 成对使用new 和delete 时要采取相同形式,............................... ...... 73
Use the same form in corresponding uses of new and delete. ……·……….. ….... 73
条款17: 以独立语句将newed 对象置入智能指针……………………......….. ………. 75
Store newed objects in smart pointers in standalone statements .. ……………….75
4. 设计与声明···································································································78
Designs and Declarations .................................................................................... 78
条款18: 让接口容易被正确使用,不易被误用…………………....……………………. 78
Make interfaces easy to use correctly and hard to use incorrectly…· …· … .78
条款19 : 设计class 犹如设计type ........................................................................ 84
Treat class design as type design ........... …......... …............................. …..... 蠡....84
条款20: 宁以pass-by-reference-to-const 替换pass-by-value ………………………… 86
Prefer pass-by-reference畸to-const to pass-by-value. ………· ……· ……………....... 86
条款21 : 必须返回对象时,别妄想返回其reference …………………………………... 90
Don't try to return a reference when you must return an object. ……….. ….... 90
条款22: 将成员变炽声明为private.... …………………...... ………………... ……………… 94
Declare data members private ..................... …............. …............. …................. 94
条款23: 宁以non-member、non-friend 替换member 函数呻… ………………………….. 98
Prefer non-member non-friend functions to member functions. …·…………..... 98
条款24: 若所有参数皆衙类型转换,诮为此采用non-member 函数.…………. 102
Declare non-member functions when type conversions should apply to all parameters. I 02
Effective C++中文版,第三版
目录x_ix
条款25: 考虑写出一个不抛异常的swap 函数...…………………………… …·…….. 106
Consider support for a non-throwing swap. ………………………………………….. 106
5. 实现............................................................................................................. 11 3
lmplementattons ................................................................................................ 113
条款26: 尽可能延后变负定义式的出现时间...…......……….... …………………...... 113
Postpone vanable definitions as long as possi ble. …· ……… ·…………………….. 113
条款27: 尽汛少做转型动作... ...... .......................................令............................... 116
Minimize casting .......................................................................................... 116
条款28: 避免返回handles 指向对象内部成分.…..... .....……………·……………….. 123
Avoid returning "handles" to object internals ............................................... 123
条款29: 为“异常安全”而努力是值得的. ..…… …....…….... 令......……...... ……….. 127
Strive for exception-safe code. ….. …….... ….. ….. ….. …....... …· …….. …· …· ……... 127
条款30: 透彻了解inlining 的里里外外……….. …………………………· ………….. ….. 134
Understand the ms and outs of mlining ... .............. ................. .... .................. 134
条款31: 将文件间的编译依存关系降至最低……·……·……………………………….. 140
Min血1ze comp1lauon dependencies between files. …·………………….... …….. 140
6. 继承与面向对象设计....….... ….. ……... …….. …... …..... …………………·…......... 149
Inheritance and Object-Oriented Design ....... ……..... ……... ……...... …… .. …. ........ 149
条款32: 确定你的public 继承塑模出ls-a 关系..………………………… …………… 150
Make sure public inheritance models "is-a." ...... ………………………………· …… 150
条款33: 避免遮掩继承而来的名称.…………………...... ……….. ………... …………….. 156
Avoid hiding inherited names ......... …· ….. …........ ….................. …............. ….. 156
条款34: 区分接口继承和实现继承..……....……………………………...... …………….. 161
Differentiate between inheritance of interface and inheritance of implementation. 161
条款35 : 考虑virtual 函数以外的其他选择………...... …………………... ………….... 169
Cons ider alternatives to virtual functions .. ….. ….. …........ …...... …….. ….......... 169
条款36: 绝不顶新定义继承而来的non-virtual 函数..令........…………… …… …..... 178
Never redefine an inherited non-virtual function. ……………… …………… …….. 178
条款37: 绝不项新定义继承而来的缺省参数值,……………………………………….. 180
Never redefine a fun ction's inherited default parameter value. ……………...... 180
条款38: 通过复合塑模出has-a 或根据某物实现出" ... ………················ 令...…. 184
Model "has-a" or "is-implemented-in-terms-or• through composition ......... 184
条款39: 明智而审慎地使用private 继承………········……………………… .... ……….. 187
Use private inheritance j udi ciously ............ …….. …......... ….. ………................. 187
条款40: 明智而审惧地使用多重继承.………………………………………·…………….. 192
Use multiple inhentance jud1c1ously ................... …...................................... 192
7. 模板与泛型编程................................................................. ....... ................. 199
Templates and Generic Progranurung…………· …. .. .. …·…........ …...... 令......……….. 199
Effective C++ 中文版,第三版
xx 目录
条款4 1 : 了解隐式接口和编译期多态.………..……....... ………………………………... 199
Understand implicit interfaces and compile-time polymorphism. ……·…...... 199
条款42: 了解typename 的双蜇意义……..…………... ………....... ………………... …203
Understand the two meanings oftypename. ……………….. ……………………….. 203
条款43 : 学习处理模板化基类内的名称..…………………………···········…... ……….. 207
Know how to access names in templattzed base classes. ……….... ……·……….207
条款44: 将与参数无关的代码抽离templates ……………………………………………. 212
Factor parameter-independent code out of templates………………· ….. …….. 212
条款45: 运用成员函数模板接受所有兼容类型…………..………………………....... 218
Use member function templates to accept "all compatible types." .. …………218
条款46: 需要类型转换时请为模板定义非成员函数…………………………………. 222
Define non-member functions inside templates when type conversions are desired ... 222
条款47: 诮使用traits classes 表现类型信息…………………………...........…….. ….. 226
Use traits classes for information about types .. ………………............ ……..... ….226
条款48 : 认识template 元编程............................................................................ 233
B e aware of template metaprogramnung . . ….................. …............................ 233
8. 定制new 和delete...................................................................................... 239
Custo而zing new and delete ....................................... .. _. ................................... 239
条款49. 了解new-handler 的行为,...………... ……………………………... ……........ …. 240
Understand the behavior of the new-handler .. ………………………·……….. ….... 240
条款50: 了解new 和delete 的合理替换时机………………………………………. 247
Understand when it makes sense to replace new and delete. …………………... 247
条款51: 编写new 和delete 时衙固守常规……………..…………….. ………….... 252
Adhere to convention when wnttng new and delete. …·….. ………………......... 252
条款52: 写了placement new 也要写placementdelete………………………… 256
Write placement delete 1fyou write placement new. …….. …·…………….. …….256
9. 杂项讨论······························· ········ ········ ······················································262
Miscellany ......................................................................................................... 262
条款53: 不要轻忽编译器的警告…..............….......... …………· ……………………..... 262
Pay attention to compiler warnings ......................... …· …......... …............. …... 262
条款54: 让自己熟悉包括TRI 在内的标准程序库…·………………………·……….. 263
Familiarize yourself with the standard library, including TRI. ………..... …... 263
条款55: 让自己熟悉Boost ................................................................................. 269
Familiarize yolll'Self with Boost. ................................................................... 269
A 本书之外............................. .. ..... .. . .......................... . . . ... . . . ..... .. ..... . ... ........... 273
B索弓尸旧版条款对映:;;
c++标准库参考.chm
C++的标准参考库,可以拿来用作参考手册,个人尤其是对C++的初学者很重要,因为在了解不同的函数用法之后,就可以可以增强自己的自主动手能力,打牢自己的基础。
希赛信息项目管理师视频资源31讲
信息项目管理师考试视频辅导资料,一共2.73个GB,附带论文参考资料
用例叙述模板
系统分析师UML实务手册的作者邱郁惠倡导的用例叙述格式
Java核心技术-基础知识(第8版)
我们假定读者愿意(甚至渴望)学习Java提供的所有高级特性。本书将详细介绍下列内容:
· 面向对象程序设计· 异常处理
· 反射与代理· 泛型程序设计
·接口与内部类· 集合框架
·事件监听器模型·并行操作
· 使用Swing UI工具箱进行图形用户界面设计
[ASP.NET.MVC.4.Web编程].徐雷等.扫描版
本书介绍了微软最新的AS P.NET MVC 4框架,帮助我们了解整个
ASP.NET MVC 4框架的运行原理,包括如何使用ASP.NET MVC 4
框架构建Web应用程序以及如何在真实开发场录中使用ASP.NET
MVC4框架新特性来解决不同的问题。通过本书的学习,将学会
如何使用HTML 、JavaScript 、Entity Framework以及其他Web相关
的技术,比如Web网站性能优化、级存等枝术。
通过本书的学习,我们不仅可以了解最基本的MVC架构桢式,而
且还可以了解与此相关的高级知识点。为了便干大家更好地学习
ASP.NET MVC 4框架开发的最佳实践经验以及相关知识,作者特
意编写了一个电子交易网站"EBuy '' 应用程序,作为参考实例。
深入理解linux内核(第三版.中文)【有目录】
当着手翻译第三版时,我不由得回想起开始接触Linux 的那投日子。
几年前,当我们拿到Linux 内核代码开始研究时,可以说茫然无措。其规模之大,叫“覆
压三百余里,隔离天日”似乎不为过;其关系错综复杂,叫"廊腰线回,檐牙高啄,各
抱地势,勾心斗角”也非言过其实。阿房宫在规模和结构上给人的震撼可能与Linux 有
异曲同工之妙。“楚人一炬,可怜焦土”,可能正是因为它的结构和规模,阿房宫在中国
两十多年矗极的计建历史中终于没有再现,只能叫后人扼腕叹息;但是, Linux 却实实
在在地矗立在我们面前,当我们徘徊在这宏伟宫殿之前时,攻许,我们也需要火炬
不是用来效灭,而是为了照亮勇者脚下的征途。
Linus Torvalds 在我们面前展现的Linux 魔法卷轴,让我们的视野进入一个自由而开放
的新世界。自由意味着自我价值的实现,开放代表着团结协作的理想,这对于从没把握
过核心操作系统的中国人来说,无疑燃起了心中的梦想。于是,许多人毫不犹豫地走进
来了,希望深入到那散发自由光彩、由众人团结协力搭造起的殿堂。但是很快,不少人
迻缩了。面对这样一个汪洋大诲,有的人迷惑了,出诲的航道在哪里?有的人倒下了.
漫漫征途何时是尽头?我常常想,如果那时他们手中就有这本书的话……
Daniel P.Bovet 和Marco Cesati 携手为我们打造了这本浅无巨著,自此我们有了火把,
有了航诲图,于是我们就有了彼岸,有了航道,也有了补给码头。不是吗?中断虽繁,
但笫四、六两章切中肯紧的剖析,肯定能让你神清气爽;内存管双虽淮, 但多达三章细
致入微的说理一定会让你茅塞顿开。内容的组织更是别具匠心,每章开始部分一般性原
理的描述打破了知识的局限,将每个部分的全景展现在你面前。而针对每个知识点芯到
实处的独到分析,又会使你沉迷于知识的社会贯通之中。第三版对Linux 2.6 的全面描
述会使你为2.4 与2.6 之间的沟壑而感叹`但请放心,你曾从Linux 旧版本中荻取的点滴
依然是你前进的基石。总之,你面对的不再是赤裸裸的代码,而是真正能雅俗共赏的艺
术。
对整
Spring源码深度解析
Spring 是于2003 年兴起的一个轻址级的Java 开源框架,由Rod Johnson 在其著作《Expert
One-On-One J2EE Development and Design 》中阐述的部分理念和原型衍生而来。Spring 是为了
解决企业应用开发的复杂性而创建的,它使用基本的JavaBean 来完成以前只可能由EJB 完成
的事情。然而, Spring 的用途不仅限于服务器端的开发。从简单性、可测试性和松耦合的角度
而言,任何Java 应用都可以从Spring 中受益。
editplus5.0+注册码
2018年4月更新,editplus小巧便捷,还能远程连接并且编辑服务器上的资源。
淘宝技术这十年,完整最终确认版【有目录】
淘宝技术这十年,完整最终确认版.从一章开始,全书共十章。目录及正文,均写为 第1章 第2章 直至第10章;同时,节标题写为2.1 2.2等;节以下标题,只显示标题名,无序号。目录中字号及缩进区分,正文中字号一次递减,区分尽可能清晰。
ADC阿里技术嘉年华2013
这是一个整合的阿里技术合集,ADC阿里技术嘉年华2013。
JsonViewer
这个工具是使用java写的,可以格式化jason数据,很方便的一个小工具,在获取一大串json数据后,往往理不清里面的父子级关系,但是这个工具可以。
软件工程(中文版 第八版)【有目录+可编辑】
读者群
本书是针对本科生和研究生课程的,同时也针对商业和工业领域工程师。本书可以用作一般
软件工程课程或者是像高级程序设计、软件描述、软件设计和管理等课程的教科书。软件工程师
可以将它作为一般性读物或者是用于更新自己在某个特殊方面的知识,例如需求工程、体系结构
设计、可靠性软件开发和过程改善等专题。无论课本中的例子的实用性如何,作者试图让它们反
映软件工程师所必须开发的一些应用的类型。
架构探险 从零开始写javaweb框架
架构探险 从零开始写javaweb框架,真的是从0开始教学java框架,也是别人推荐给我的,很值得一看。
实用负载均衡技术:网站性能优化攻略.((英)Peter Membrey).[PDF]
本书面向对Web 应用后台支撑系统感兴趣的Web 开发和设计人员。全书围绕着横向扩展这
个主题,力图准确到位地介绍基础概念及扩展服务器时所需要的具体工具和详细操作步骤,并在
必要时补充大量的背景知识,以便读者迅速了解相关技术。
在翻译过程中,我们也看到了原书的诸多不足之处:垂直深度略显不足(书中并未介绍进行
大规模服务器配置部署时的相关自动化工具,如chef、puppet 。)、介绍规划一章略显冗余(这些
概念完全可以渗入其他章节,无需浪费篇幅)、原书看起来有点绕口(可能是因为合著的原因,
很多地方对同个概念多次重复,甚至前后两段出现重复的几句话,颇显嘐嗦),以及一些概念性
错误(比如对虚拟内存的理解存在偏差,对1Pv6 的理解也出现了前后不一致的清况)。这些我们
都竭尽所能, 一一校正,还望与读者诸君交流为盼。
从整体上来看,这是一本比较好的负载均衡入门书籍,内容也较新(已出版的几本相关英文
著作都较早) 。鉴于国内尚未有同类译著上市,我们希望本书的出版能满足入门人员的需要。翻
译过程中,我们针对其中涉及的概念和术语进行了多次讨论和推敲,并对译稿进行了严格的相互
审读。即于经验,难免有一些疏漏和不足之处,还需各位读者予以积极反馈。我们会在图灵社区
维护一份勘误表(http://www.ituring.eom.cn/book/1050), 以便各位参考和在下一印次中更正。
企业应用架构模式【有目录】
构建计算机系统并非易本。随常系统复杂性的增大,构建相应软件的难度将呈指数增大。
同其他行业一样,我们只有在不断的学习中进步,从成功经验中学习,从失败教训中学习、才
有望克服这些困难e 本书中的内容就是这样一些“学习“经验。我希望它们的撰写和编排方式,
能够有助于读者更快地学习这些内容,井且,和我在总结出这些筷式之前相比, 能更有效地与
他人进行交流。
在引言中,我想设定本书讨论的范围,井提供一些相关的秤呆知识与材料。
[一线架构师实践指南].温昱.扫描版
画龙须点睛。
在介绍具体方法之前,先来阐释本书的4 个核心主张:
• 方法体系是大趋势。
• 质疑驱动的架构设计。
• 多阶段方法。
• 内置最佳实践的方法。
这4 个核心主张可帮助读者领会ADMEMS 方法之精髓。
数据恢复软件
在磁盘没有被复写的情况下,可以100%的恢复数据,对于已经复写的情况,有一定几率恢复。
[分布式Java应用基础与实践].林昊【高清+章、节目录+可搜索+可编辑/复制/粘贴+无密码】
一、下载须知
1、------------》用于传播和交流思想
2、------------》章节目录
3、------------》已经进行解密处理,大多数PDF会进行加密以至于无法编辑
4、------------》高清
5、------------》可直接复制粘贴源码
6、------------》可搜索某一段内容
附注:本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。仅用于交流和传播思维模式。
二、目录预览
目录
前言... .. ......... ......................... . . ... ...... . .. ............. ......... .. .. .................... ... . .... ........ .. .. 1
第1 章分布式Java 应用.......... . . ....................... ..... .. .. ......... .. ...... .... . . . ... .. .... ... .. . 1
1.1 基千消息方式实现系统间的通信... ....................... .. . .. .. .. .. . ...................…............ .......... 3
1.1.1 基千Java 自身技术实现消息方式的系统间通信,…..........…………........... …·….3
l.1.2 基千开源框架实现消息方式的系统间通信…………....…·…... ……………....... …. 10
1.2 基于远程调用方式实现系统间的通信.....…... ………·…….... …………………·…·….... …..... 14
1.2.1 基千Java 自身技术实现远程调用方式的系统间通信, . .. .…………·…...... ... ….. 14
1.2.2 基千开源框架实现远程调用方式的系统间通信..…....…... …............... ……….. 17
第2 章大型分布式Java 应用与SOA ..... ......................................................... 23
2.1 基于SCA 实现SOA 平台·············· · ·· · ··.. . ........ .. . ...... . . ................................................. .26
2.2 基千ESB 实现SOA 平台... . . . ........................... .... .......... .. ......... . .. . .................. . . .. . ...... . .29
2.3 基千Tuscany 实现SOA 平台........ . .. . .. ......... .. . .. . ...... ...... .. .. .. . ..... . ...... .. .. .. . ....... . . .. .. . ..... .30
2.4 基千Mule 实现SOA 平台.. . . ..... .. . . . . ................... . . ..... . .. .. . .. .. ......... .... ....... .. . ...... . .. . ...... ..34
第3 章深入理解JVM ... ........................... .... ............................ .. ... ................... 39
3.1 Java 代码的执行机制............. ... .. .. . ... ........... ................. .... ..... .. . ...... .. .. . ................ ..... ... .40
3.1.l Java 源码编译机制.... . .......... . .. .. .. . . . .. ... ........................... . . ... ...... .. . .. . ...... .... . ....... 41
3.1.2 类加载机制.......... ........ .. .. .. . ......... .. . .......... ........................... . . . ......... ... ..... . . . .......44
3.1.3 类执行机制.. ....... . ..... ........... .. ...... .. . ................ .. .. .. .. ... .... ..... .. .. ........ . .. ...... ...... . . ..49
3 .2 JVM 内存管理. . . .. ..... .. . .. .................................. .. .. . .. . . .. ..... . ....... . ..... .. ....... . .... ... ..... . . ........63
罕Java 应思基础等实践
xiv 目录
3.2.1 内存空间... .. . . . .... ..... .. . .... ........ ................... . .... .................... .. . ... .. . ..... ............. .. . . 6. 3
3.2.2 内存分配..... .. ..... . ...... ... . ................ . . ..... ... ..... .. ..... ............ . ............ ... . ..... . ............65
3.2.3 内存回收 ........ ...................................... .... ...................... .. .................6 6 .................
3.2.4 JVM 内存状况查看方法和分析工具..……..……........... . .. ...... . .................. .... 92
3.3 JVM 线程资源同步及交互机制... . . ... ... ... . ... .................................. . ............................ 100
3.3.1 线程资源同步机制... . .. ...... . . . .............................................. . ...... . ... .. . .. . . .......... .100
3.3.2 线程交互机制 ................................. ...... ....... . .. ...... .. .. ... .. ... ... .. ..... ... . ... . ... . ...... .. 1. 04
3.3 3 线程状态及分析.............. ....... ................. ..... ........ . ................. . .... ,........ . .........1. 05
第4 章分布式Java 应用与Sun JDK 类库......... ........ .. .. ….................... ......... 111
4.1 集合包..................................... ..... .. . ... . .. .. ............ .. . ... ................ ............ . .. .... . .. . ...... .....1. 12
4 1 I ArrayList. ........................................................................................................ ..1 13
4 1.2 LinkedList ............. , ........................................................... ····· ··· ····· ·· ···········.... ··1 16
4.1 .3 Vector .. .......... .............................. .......................... ............. ............................ .. 117
4 J .4 Stack .......... ......................... .. ............... ............................................................ 1. 18
4.1.5 HashSet ........................ ............................................................. ............. ......... ..1 19
4.1.6 TreeSet ............................................................................................................. 1. 20
4 1.7 HashMap ............................. .... .................................................... 1. 20 . . ............., .....
4.1.8 TreeMap. .......................... 参...... .. .................. . . . .......... . . ... ..... . ..... .. ...... . ......... . .... ..1 23
4.1.9 性能测试.............. . . ... .. . . .. . ... . .. . ...... ...... .... . .......... . . . . ......... . ... .. ........ ....... . .. . . ..... ..124
4.1.10 /j、结··· ···" ........................................................... ...... ......................................1. 1. 8
4.2 并发包 (java.util.concurrent) .................... .. ........... .. ...... ..................................... .... 1. 38
4.2.1 ConcurrentHashMap ................................................................ ..1 39
4.2.2 CopyOnWriteArrayList ................................................................................... 1. 45
4.2.3 CopyOnWriteArraySet ............................................. .. 149 ............. ... ........ .. ...
4.2.4 ArrayBlockingQueue ............. .... ................................... .................................... 149
4.2.5 Atomiclnte.......g...... ..........e.... ..........r....... ....•...... ... .. ................................... ·.. 1· 51
4.2.6 ThreadPoolExecutor .. ........................ .................................................... · ··.. · ··... 153
4.2.7 Executors ............................. ..... .. ............................ ........ ................ ...... ..1 57
分布式Java 应房..基酚与实践
自录xv
4.2.8 FutureTask ........... ......、............. .. ..... .......... .. .............. . .... .................................. 158
4.2.9 Semaphore ...................... .................................................................................. 161
4.2. l O CountDownLatch ....................... ................................. ................................... 162
4.2.11 CyclicBarrier ...................................... ........ ............ ......................... ............... 163
4.2.12 ReentrantLock .................. .............................................................................. 163
4.2.13 Cond1t1on ........................................................................................................ 164
4.2.14 ReentrantReadWriteLock ............................................................................... 165
4.3 序列化/反序列化................ . . .......... .. .. . .. ... .. .. . . . . . .... .... . .. ......... . ........................ . .. . .. . .. ...167
4.3.1 序列化............... ... ... . . .. ....... . .... ... .. .... ................. .... ... .. . . .. .. ... . ... .. . ... .. .. . ...... . ....... 167
4.3.2 反序列化.... ... . ........ . ........... . ........... . ... .. . . . ............... . .... ....... . .... . .. .. ... .. .. . ............169
第5 章性能调优... ... ... . . .. . . ... . ................. . .......... .. . . ... . ..... .. . . ... . ............ . ... . .. .. . .. 173
5.1 寻找性能瓶颈···· ····· ·· ..······ ···········... ·······································.. ····· ··········... ·········.. ······175
5.1.1 CPU 消耗分析....... . .............. . .. .. . ... .. .. .. . ... . ........ ..... . . .. ............. .. ..... ... ........ . ......175
5.1.2 文件IO 消耗分析,· · ··· · ·················· · ..···················································............. 182
5.1.3 网络10 消耗分析, · ······ ·· · ···· · · ······ ··· · ····· ···· ··· ··· ·· · · ························· · · · "······ · ·· · · · ····186
5.1.4 内存消耗分析··· ··········· ···· · ······· ······················ · ···········...................................... 187
5.1.5 程序执行慢原因分析.. . ........ .................... .. . . .... . ........ .. ............. . . . .... ...... . . ........19!
5.2 调优............................ ............................................. . ............................. . .... .. . . .. ... . . . . . ...192
5.2.I NM 调优..... ........ . . .. . . .... . . . ... . . . . . .... . .. . . . .... . ............ . ........ . ....... . .......................... 192
S.2.2 程序调优··· · · ······· ········ ············ · ·············· ································· · ···· · ······· · · ···········202
5.2.3 对千资源消耗不多, 但程序执行慢的情况...…....…………... …….. …... …….... 214
第6 章构建高可用的系统.. . .. .. .. ....... . ......... .. .. . .. . . . .. ........... . ................ . .. . . .. ... .. 227
6.1 避免系统中出现单点············· ·· ·· ···· · ····· · ·························· · ································· ···· · ··· · ·228
6.1.1 负载均衡技术···· ········ · ·· ··· · · ······ ··· · ··· · ············· · ···· · ······ · · · ···················· ·· · ·· · ·· · · · ·· · · ·228
6.1.2 热备········· ··········································· ··········· ············································· ·····236
6.2 提高应用自身的可用性... . . . . ....................................... . . .. .. ..... .... . ....... .................. .... . ..238
6.2.) 尽可能地避免故障··········· · ·· · · ·· ······ ·· · ················· · ...... . ..... ..................... .. ... .... ...239
6.2.2 及时发现故障· · ·········· ··········· · ···· · · ·········· .. ............................ . .... ....... . .............. 246
分布式Java 应思基础与实践
xvi 吕录
6.2.3 及时处理故院........................ . ......... ... .......... . ... . ....... . . . .......... . ..... . ........... .. ..... .248
6.2.4 访问量及数据量不断上涨的应对策略…… ...... .. ........…..... ……... ……….. …….. 249
第7 章构建可伸缩的系统· ···· ··· · ··· ········· ·· · · ···················· · · ······ · ···· · ·········· · ··· · ····251
7.1 垂直伸缩····················· ··· ·· ·· · ········· ·· ··...·........................................................................ 252
7.1.1 支撑商访问量................................. . . ... .. . ......... . ....... . ...... . .. .. ..... . ..................... .252
7.1.2 支撑大数据量.... . .. ...... . ......................................... . ......................................... .254
7.1.3 提升计算能力.... . .............. .... ........ ...... . ......... .. ........................... .. . ....... . .. . ........254
7.2 水平伸缩...................................................... . ...... . .. . ................... . .... . ............................254
7.2.l 支撑高访问焦............................................... . ........ . ...... . .... .. ......... . . ...... .. .. . ......254
7.2.2 支撑大数据量....................... .. ......... ... ...................... ...................... . ......... . ......264
7.2.3 提升计算能力.. ........ .. ........ .. .. . ....................... ... . .. ............................................266
[现代编译原理C语言描述].(美国)Andrew.W.Appel【高清+章、节目录+可搜索+可编辑/复制/粘贴+无密码】
一、下载须知
1、------------》用于传播和交流思想
2、------------》章节目录
3、------------》已经进行解密处理,大多数PDF会进行加密以至于无法编辑
4、------------》高清
5、------------》可直接复制粘贴源码
6、------------》可搜索某一段内容
附注:本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。仅用于交流和传播思维模式。
二、目录预览
目录
第一部分编译基本原理
第1 章绪论. . . . . . . . . . . . . . . . . . . . . . .. ... . . . . . . . . . . . . I
l. l 模块与接口................................. l
I. 2 T具和软件................................. 3
I. 3 树语言的数据结构........................ 3
程序设计:直线式程序解释器…………… 7
推荐阅读.......................................... 9
习题................................................ 9
第2 章词法分析.............................. 10
2. I 词法单词................................. 10
2.2 正则表达式·· · · · · · · · · · · · · · · ·· ·· · · · · · ·· · · ·11
2.3 有限自动机.............................. 13
2.4 非确定有限自动机………………… 15
2.4. 1 将正则表达式转换为NFA … 16
2.4. 2 将NFA 转换为DFA ………… 18
2. 5 Lex: 词法分析器的生成器………... 20
程序设计:词法分析........................... 22
推荐阅读.......................................... 23
习题................................................ 23
第3 章语法分析······························27
3. I 上下文无关文法......... …............ 28
3. I. I 推导·································29
3. I. 2 语法分析树························29
3. I. 3 二义性文法........................ 30
3. I. 4 文件结束符........................ 31
3.2 预测分析................................. 32
3. 2. I ARST 集合和FO旦DW 集合… 33
3.2.2 构造一个预测分析器………… 35
3. 2. 3 消除左递归························36
3.2.4 提取左因子························37
3.2.5 错误恢复···························37
3.3 LR 分析····································39
3.3.1 LR 分析弓1 擎..................... 40
3.3.2 LR(O) 分析器生成器………… 41
3. 3. 3 SLR 分析器的生成…………… 44
3.3.4 LR(I) 项和LR(I) 分析表…… 45
3.3.5 LALR(l) 分析表...... …...... 46
3.3.6 各类文法的层次.. …· ………… 47
3.3. 7 二义性文法的LR 分析……… 47
3.4 使用分析器的生成器……………… 48
3. 4. l 冲突................................. 49
3.4.2 优先级指导........................ 50
3. 4. 3 语法和语义........................ 53
3. 5 错误恢复................................. 54
3.5. 1 用error 符号恢复…………... 54
3.5.2 全局错误修复......... …......... 55
程序设计:语法分析……………………… 57
推荐阅读.......................................... 58
习题................................................ 58
第4 章抽象语法........................ …... 62
4. 1 语义动作................................. 62
4. 1. 1 递归下降........................... 62
4. 1. 2 Yacc 生成的分析器………… 62
4. 1. 3 语义动作的解释器…………... 64
4.2 抽象语法分析树…………………… 65
4.2. l 位置................................. 67
4. 2. 2 Tiger 的抽象语法…………… 68
程序设计:抽象语法............... …......... 71
推荐阅读.......................................... 71
习题................................................ 72
第5 章语义分析.............................. 73
5. l 符号表.................................... 73
5. 1. I 多个符号表........................ 74
5. I. 2 高效的命令式风格符号表…… 75
5. 1. 3 高效的函数式符号表………… 76
5. 1. 4 Tiger 编译器的符号·……….. 77
5. 1. 5 函数式风格的符号表………… 79
5. 2 Tiger 编译器的绑定………………… 79
5.3 表达式的类型检查………………… 82
5.4 声明的类型检查…………………… 84
5.4. 1 变量声明···························84
5.4.2 类型声明........................... 85
5.4.3 函数声明···························85
2 目录
5.4.4 递归声明···························86
程序设计:类型检查.................. …...... 87
习题················································87
第6 章活动记录.............................. 89
6. 1 栈帧....................................... 90
6. I. I 帧指针.............................. 91
6. I. 2 寄存器.............................. 92
6. I. 3 参数传递···························92
6. I. 4 返回地址···························94
6. I. 5 栈帧内的变量..................... 94
6. I. 6 静态链·····················"·"····95
6. 2 Tiger 编译器的栈帧·…….. ………... 96
6. 2. I 栈帧描述的表示·…...…... ….. 98
6.2.2 局部变量........................... 98
6.2.3 计算逃逸变量···········"0""00••·99
6.2.4 临时变抵和标号…………... 100
6.2.5 两层抽象········................ 100
6.2.6 管理静态链..................... 102
6.2. 7 追踪层次信息··················102
程序设计:栈帧······························103
推荐阅读·······································103
习题·············································103
第7 章翻译成中间代码……………... 106
7. l 中间表示树······························106
7.2 翻译为树中间语言………………… 108
7. 2. I 表达式的种类……………… 108
7.2.2 简单变量· · · · · · · · · · · ·..... · · · · · · ·111
7.2.3 追随静态链············…······112
7. 2.4 数组变措· · · · · · · · · · · · ·....... · · · ·113
7.2.5 结构化的左值……………… 114
7. 2.6 下标和域选择... ···············114
7.2. 7 关千安全性的劝告………... 115
7. 2. 8 算术操作························116
7.2.9 条件表达式......... ······ ······116
7. 2. 10 字符串···························117
7. 2. 11 记录和数组的创建………… 118
7. 2. 12 while 循环·····················119
7. 2. 13 for 循环························119
7.2. 14 函数调用························120
7.3 声明·······································120
7. 3. I 变扯定义························120
7.3. 2 函数定义························120
7.3. 3 片段............... ·········...... 121
程序设计:翻译成树…………………… 122
习题.......................................... , .. 123
第8 章基本块和轨迹…………......… 125
8. 1 规范树····································126
8. I. 1 ESEQ 的转换.................. 126
8. 1. 2 一般重写规则.................. 126
8. 1. 3 将CALL 移到顶层…...…… 130
8. 1. 4 线性语句表..................... 131
8.2 处理条件分支···························131
8.2. 1 基本块........................... 131
8. 2.2 轨迹.............................. 132
8. 2. 3 完善.............................. 133
8.2.4 最优轨迹························133
推荐阅读·······································134
习题.:........................................... 134
第9 章指令选择.............................. 136
9. l 指令选择算法今.............. …......... 138
9. I. I Maximal Munch 算法·…….. 138
9. I. 2 动态规划························140
9. I. 3 树文法···························141
9. I. 4 快速匹配························143
9. I. 5 覆盖算法的效率……·…….. 143
9. 2 CISC 机器.............................. 144
9. 3 Tiger 编译器的指令选择………... 146
9.3. I 抽象的汇编语言指令……... 146
9.3.2 生成汇编指令……………... 148
9.3.3 过程调用........................ 151
9.3.4 无帧指针的情形…………... 151
程序设计:指令选择…... …... ………… 152
推荐阅读....................................... 153
习题·············································154
第IO 章活跃分析........................... 155
10. I 数据流方程的解·…….. …... …... 156
10. 1. I 活跃性计算..................... 156
10. I. 2 集合的表示... …............... 158
10. I. 3 时间复杂度..................... 158
10. I. 4 最小不动点..................... 159
10. I. 5 静态活跃性与动态活跃性... 160
10. I. 6 冲突图........................... 161
10. 2 Tiger 编译器的活跃分析…..……·162
10. 2. l 图·································162
10.2.2 控制流图························163
10.2.3 活跃分析························164
程序设计:构造流图……... …….. ……·164
程序设计:活跃分析模块………..……·165
习题............................................. 165
第11 章寄存器分配......……………… 166
11. 1 通过简化进行着色…………·….. 166
11. 2 合并.........., ......................... 168
11. 3 预着色的结点... ······............... 171
11. 3. l 机器寄存器的临时副本…… 171
11. 3. 2 调用者保护的寄存器和
被调用者保护的寄存器·….. 172
11. 3. 3 含预着色结点的例子.....…·172
11. 4 图着色的实现........................ 175
11. 4. l 传送指令工作表的管理…… 176
11. 4. 2 数据结构…......... ……...... 176
11. 4. 3 程序代码........................ 177
11. 5 针对树的寄存器分配…………… 181
程序设计:图着色……······…············184
推荐阅读....................................... 185
习题............................................. 185
第12 章整合为一体·····················… 188
程序设计:过程入口/出口……………… 189
程序设计:创建一个可运行的编译器… 191
第二部分高级主题
第13 章垃圾收集························… 193
13. 1 标记-清扫式收集………………... 194
13.2 弓I 用计数······························197
13.3 复制式收集···························198
13.4 分代收集······························201
13. 5 增量式收集··············· ……...... 203
13. 6 Baker 算法······························205
13. 7 编译器接口···························205
13. 7. I 快速分配........................ 205
13. 7.2 数据布局的描述…………… 206
13. 7.3 导出指针........................ 207
程序设计:描述字......... …... …......... 208
程序设计:垃圾收集…………………… 208
推荐阅读....................................... 208
习题·············································210
第14 章面向对象的语言……………… 211
14. I 类....................................... 211
14.2 数据域的单继承性……………… 213
目录3
14.3 多继承·································214
14.4 测试类成员关系.…..... ………... 216
14.5 私有域和私有方法………·…….. 218
14.6 无类语言.............................. 219
14. 7 面向对象程序的优化·………….. 219
程序设计: OBJECT-Tiger ………·…….. 220
推荐阅读..........................暑............ 220
习题............................................. 221
第15 章函数式程序设计语言………... 222
15. 1 一个简单的函数式语言………… 222
15.2 闭包····································224
15.3 不变的变量...... …······ …......... 225
15. 3. l 基于延续的1/0 …………... 226
15.3.2 语言上的变化·….. …·…..... 227
15.3. 3 纯函数式语言的优化……... 228
15.4 内联扩展······························229
15.5 闭包变换······························233
15.6 高效的尾递归........................ 235
15. 7 懒惰计算······························236
15. 7. 1 传名调用计算………... …... 237
15. 7.2 按需调用........................ 238
15. 7.3 懒惰程序的计算·………….. 239
15. 7.4 懒惰函数式程序的优化…... 239
15. 7.5 严格性分析…······ …......... 241
推荐阅读·······································243
程序设计:编译函数式语言…………... 244
习题............................................. 244
第16 章多态类型……·················…·246
16. I 参数多态性........................... 246
16. I. I 显式带类型的多态语言…... 247
16. I. 2 多态类型的检查·………….. 248
16.2 类型推论······························253
16.2. I 一个隐式类型的多态语言... 254
16.2.2 类型推论算法…... ………... 255
16.2.3 递归的数据类型.. ….... …... 257
16. 2. 4 Hindley-Milner 类型的能力… 259
16.3 多态变量的表示………………... 259
16. 3. I 多态函数的扩展·………….. 260
16.3.2 完全的装箱转换·………….. 261
16. 3. 3 基于强制的表示分析..……·262
16.3.4 将类型作为运行时参数
传递······························264
16.4 静态重载的解决方法·………….. 265
4 目录
推荐阅读....................................... 266
习题·············································266
第17 章数据流分析…………………… 269
17. I 流分析使用的中间表示………… 270
17.2 各种数据流分析……... ………... 271
17. 2. I 到达定值························271
17.2.2 可用表达式............……... 273
17.2.3 到达表达式··············· …... 274
17.2.4 活跃分析…············ …...... 274
17.3 使用数据流分析结果的儿种
转换·························--·········274
17. 3. I 公共子表达式删除………... 274
17.3.2 常数传播...…··················275
17.3. 3 复写传播························275
17. 3. 4 死代码删除·····················275
17.4 加快数据流分析……...………… 276
17. 4. I 位向量···························276
17.4.2 基本块···························276
17.4.3 结点排序························277
17.4.4 使用-定值链和定值-
使用链···························277
17.4.5 工作表算法············ …...... 278
17.4.6 增蜇式数据流分析……·….. 278
17.5 别名分析······························281
17. 5. I 基于类型的别名分析·…….. 282
17.5.2 基于流的别名分析………... 283
17.5.3 使用可能别名信息………... 284
17.5.4 严格的纯函数式语言中的
别名分析························285
推荐阅读....................................... 285
习题·············································285
第18 章循环优化···························287
18. I 必经结点······························289
18. I. I 寻找必经结点的算法……... 289
18. I. 2 直接必经结点············ …... 289
18. I. 3 循环······························290
18. 1. 4 循环前置结点……………... 291
18.2 循环不变量计算…...…………… 292
18.3 归纳变量··················--··········293
18. 3. I 发现归纳变量…...………… 294
18.3.2 强度削弱........................ 295
18.3.3 删除······························296
18. 3.4 重写比较... …············ …… 296
18.4 数组边界检查························297
18.5 循环展开······························300
推荐阅读·······································301
习题·············································301
第19 章静态单赋值形式……………… 303
19. 1 转化为SSA 形式………………… 305
19. 1. 1 插人中函数的标准………… 306
19. 1. 2 必经结点边界... ………... … 306
19. 1. 3 插人中函数..................... 308
19. 1. 4 变量重命名............ …...... 309
19. 1. 5 边分割........................... 310
19.2 必经结点树的高效计算………… 310
19. 2. 1 深度优先生成树…·……….. 310
19.2.2 半必经结点… ···········--·····311
19. 2. 3 Lengauer-Tarjan 算法…·….. 312
19.3 使用SSA 的优化算法………·….. 315
19. 3. 1 死代码删除..................... 315
19.3.2 简单的常数传播…………… 316
19.3.3 条件常数传播......... …...... 317
19.3.4 保持必经结点性质………… 319
19.4 数组、指针和存储器…………… 320
19.5 控制依赖图........................... 321
19.6 从SSA 形式转变回来…………… 323
19. 7 函数式中间形式…······………… 324
推荐阅读·······································327
习题·············································328
第20 章流水和调度…………………… 331
20. 1 没有资源约束时的循环调度..…·332
20.2 有资源约束的循环流水……..…·336
20.2. 1 模调度···························337
20.2.2 寻找最小的启动间距……… 338
20.2.3 其他控制流·····················340
20.2.4 编译器应该调度指令吗..…·340
20.3 分支预测······························341
20.3. 1 静态分支预测...…………… 342
20.3.2 编译器应该预测分支吗..…·342
推荐阅读....................................... 343
习题·············································343
第21 章存储层次…........................ 346
21. I cache 的组织结构················--… 346
21. 2 cache 块对齐........................... 349
21. 3 预取.................................... 350
21. 4 循环交换.............................. 354
目录5
21. 5 分块··········· 参..金·····················355 附录Tiger 语言参考手册…....………….. 360
21. 6 垃圾收集和存储层次…·……….. 357 参考文献.......................................... 368
推荐阅读·······································358 索弓I················································376
习题·············································358
Windows程序设计(第五版)【高清+章节目录+可搜索+可编辑/复制/粘贴+无密码】
一、下载须知
1、------------》用于传播和交流思想
2、------------》章节目录
3、------------》已经进行解密处理,大多数PDF会进行加密以至于无法编辑
4、------------》高清
5、------------》可直接复制粘贴源码
6、------------》可搜索某一段内容
附注:本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。仅用于交流和传播思维模式。
二、全部目录如下
目 录
第一章 开始......................................................................................................................................1
WINDOWS环境.............................................................................................................................1
Windows 简史..............................................................................................................................2
Windows方面..............................................................................................................................3
动态连结.......................................................................................................................................5
WINDOWS程式设计选项.............................................................................................................6
API 和记忆体模式.......................................................................................................................7
语言选项.......................................................................................................................................8
程式开发环境...............................................................................................................................9
API 文件.....................................................................................................................................10
编写第一个WINDOWS程式......................................................................................................10
文字模式(Character-Mode)模型..........................................................................................10
同样效果的Windows 程式....................................................................................................... 11
表头档案.....................................................................................................................................12
程式进入点.................................................................................................................................13
MessageBox 函式.......................................................................................................................14
编译、连结和执行.....................................................................................................................15
第二章 UNICODE 简介................................................................................................................17
字元集简史....................................................................................................................................17
美国标准.....................................................................................................................................18
国际方面.....................................................................................................................................19
扩展ASCII .................................................................................................................................20
双位元组字元集.........................................................................................................................22
Unicode 解决方案......................................................................................................................22
宽字元和C ....................................................................................................................................23
char 资料型态.............................................................................................................................24
宽字元.........................................................................................................................................24
宽字元程式库函式.....................................................................................................................25
维护单一原始码.........................................................................................................................27
宽字元和WINDOWS ...................................................................................................................28
Windows表头档案类型............................................................................................................28
Windows 函式呼叫....................................................................................................................30
Windows 的字串函式................................................................................................................31
在Windows 中使用printf..........................................................................................................31
格式化讯息方块.........................................................................................................................33
本书与国际化.............................................................................................................................34
第三章 视窗和讯息........................................................................................................................36
自己的视窗....................................................................................................................................36
总体结构.....................................................................................................................................36
HELLOWIN程式.......................................................................................................................38
通盘考量.....................................................................................................................................41
Windows 函式呼叫....................................................................................................................41
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 2 页
大写字母识别字.........................................................................................................................42
新的资料型态.............................................................................................................................43
代号简介.....................................................................................................................................44
匈牙利表示法.............................................................................................................................44
注册视窗类别.............................................................................................................................46
建立视窗.....................................................................................................................................51
显示视窗.....................................................................................................................................53
讯息回圈.....................................................................................................................................54
视窗讯息处理程式.....................................................................................................................55
处理讯息.....................................................................................................................................56
播放音效档案.............................................................................................................................57
WM_PAINT 讯息.......................................................................................................................57
WM_DESTROY讯息................................................................................................................59
WINDOWS程式设计的难点.......................................................................................................60
别呼叫我,我会呼叫您.............................................................................................................60
伫列化讯息与非伫列化讯息.....................................................................................................61
行动迅速.....................................................................................................................................63
第四章 输出文字............................................................................................................................64
绘制和更新....................................................................................................................................64
WM_PAINT 讯息.......................................................................................................................65
有效矩形和无效矩形.................................................................................................................66
GDI 简介........................................................................................................................................66
装置内容.....................................................................................................................................67
取得装置内容代号:方法一.....................................................................................................67
绘图资讯结构.............................................................................................................................68
取得装置内容代号:方法二.....................................................................................................71
TextOut:细节............................................................................................................................71
系统字体.....................................................................................................................................73
字元大小.....................................................................................................................................74
文字大小:细节.........................................................................................................................75
格式化文字.................................................................................................................................76
综合使用.....................................................................................................................................77
SYSMETS1.C视窗讯息处理程式............................................................................................84
空间不够.....................................................................................................................................85
显示区域的大小.........................................................................................................................86
卷动列............................................................................................................................................87
卷动列的范围和位置.................................................................................................................88
卷动列讯息.................................................................................................................................90
在SYSMETS中加入卷动功能.................................................................................................92
绘图程式的组织.........................................................................................................................96
建立更好的滚动............................................................................................................................97
卷动列资讯函式.........................................................................................................................97
卷动范围.....................................................................................................................................99
新SYSMETS............................................................................................................................100
不用滑鼠怎么办.......................................................................................................................106
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 3 页
第五章 图形基础..........................................................................................................................107
GDI 的结构..................................................................................................................................107
GDI 原理...................................................................................................................................107
GDI 函式呼叫...........................................................................................................................109
GDI 基本图形........................................................................................................................... 110
其他部分................................................................................................................................... 110
装置内容...................................................................................................................................... 111
取得装置内容代号................................................................................................................... 111
取得装置内容资讯................................................................................................................... 113
DEVCAPS1程式..................................................................................................................... 114
装置的大小............................................................................................................................... 117
关於色彩...................................................................................................................................123
装置内容属性...........................................................................................................................124
保存装置内容...........................................................................................................................126
画点和线......................................................................................................................................127
设定图素...................................................................................................................................127
直线...........................................................................................................................................128
边界框函式...............................................................................................................................133
贝塞尔曲线...............................................................................................................................139
使用现有画笔(Stock Pens).................................................................................................144
画笔的建立、选择和删除.......................................................................................................145
填入空隙...................................................................................................................................148
绘图方式...................................................................................................................................148
绘制填入区域..............................................................................................................................150
Polygon函式和多边形填入方式............................................................................................151
用画刷填入内部.......................................................................................................................155
GDI 映射方式..............................................................................................................................157
装置座标和逻辑座标...............................................................................................................159
装置座标系...............................................................................................................................159
视埠和视窗...............................................................................................................................160
处理MM_TEXT......................................................................................................................162
「度量」映射方式...................................................................................................................164
「自行决定」的映射方式.......................................................................................................168
MM_ISOTROPIC映射方式....................................................................................................168
MM_ANISOTROPIC:根据需要放缩图像...........................................................................171
WHATSIZE程式......................................................................................................................172
矩形、区域和剪裁......................................................................................................................176
矩形函式...................................................................................................................................176
随机矩形...................................................................................................................................177
建立和绘制剪裁区域...............................................................................................................181
矩形与区域的剪裁...................................................................................................................183
CLOVER 程式..........................................................................................................................184
第六章 键盘..................................................................................................................................189
键盘基础......................................................................................................................................189
忽略键盘...................................................................................................................................189
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 4 页
谁获得了焦点...........................................................................................................................190
伫列和同步...............................................................................................................................191
按键和字元...............................................................................................................................191
按键讯息......................................................................................................................................192
系统按键与非系统按键...........................................................................................................192
虚拟键码...................................................................................................................................193
lParam资讯..............................................................................................................................197
重复计数...................................................................................................................................197
OEM 扫描码.............................................................................................................................197
扩充键旗标...............................................................................................................................198
内容代码...................................................................................................................................198
键的先前状态...........................................................................................................................198
转换状态...................................................................................................................................198
位移状态...................................................................................................................................198
使用按键讯息...........................................................................................................................199
为SYSMETS加上键盘处理功能...........................................................................................200
字元讯息......................................................................................................................................208
四类字元讯息...........................................................................................................................208
讯息顺序...................................................................................................................................209
处理控制字元........................................................................................................................... 211
死字元讯息............................................................................................................................... 211
键盘讯息和字元集......................................................................................................................212
KEYVIEW1 程式.....................................................................................................................212
外语键盘问题...........................................................................................................................218
字元集和字体..............................................................................................................................220
Unicode 怎么样?....................................................................................................................231
TrueType 和大字体..................................................................................................................232
插入符号(不是游标)..............................................................................................................239
插入符号函式...........................................................................................................................239
TYPER程式.............................................................................................................................240
第三章 滑鼠..................................................................................................................................248
滑鼠基础......................................................................................................................................248
一些简单的定义.......................................................................................................................249
滑鼠(Mouse)的复数.................................................................................................................250
显示区域滑鼠讯息......................................................................................................................250
简单的滑鼠处理:一个例子...................................................................................................252
处理Shift 键.............................................................................................................................256
双击滑鼠按键...........................................................................................................................257
非显示区域滑鼠讯息..................................................................................................................258
命中测试讯息...........................................................................................................................259
从讯息产生讯息.......................................................................................................................260
程式中的命中测试......................................................................................................................261
一个假想的例子.......................................................................................................................261
范例程式...................................................................................................................................262
使用键盘模拟滑鼠...................................................................................................................265
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 5 页
在CHECKER中加入键盘介面..............................................................................................266
将子视窗用於命中测试...........................................................................................................271
CHECKER 中的子视窗...........................................................................................................271
子视窗和键盘...........................................................................................................................276
拦截滑鼠......................................................................................................................................282
设计矩形...................................................................................................................................282
拦截的解决方案.......................................................................................................................286
BLOKOUT2程式.....................................................................................................................287
滑鼠滑轮......................................................................................................................................290
下面还有...................................................................................................................................299
第八章 计时器..............................................................................................................................300
计时器入门..................................................................................................................................300
系统和计时器...........................................................................................................................301
计时器讯息不是非同步的.......................................................................................................301
计时器的使用:三种方法..........................................................................................................302
方法一.......................................................................................................................................302
方法二.......................................................................................................................................306
方法三.......................................................................................................................................309
计时器用於时钟..........................................................................................................................310
建立数位时钟...........................................................................................................................310
取得目前时间...........................................................................................................................315
显示数字和冒号.......................................................................................................................315
国际化.......................................................................................................................................316
建立类比时钟...........................................................................................................................317
以计时器进行状态报告..............................................................................................................323
第九章 子视窗控制项..................................................................................................................327
按钮类别......................................................................................................................................328
建立子视窗...............................................................................................................................332
子视窗向父视窗发讯息...........................................................................................................334
父视窗向子视窗发送讯息.......................................................................................................335
按键...........................................................................................................................................336
核取方块...................................................................................................................................337
单选按钮...................................................................................................................................338
分组方块...................................................................................................................................338
改变按钮文字...........................................................................................................................338
可见的和启用的按钮...............................................................................................................339
按钮和输入焦点.......................................................................................................................339
控制项与颜色..............................................................................................................................340
系统颜色...................................................................................................................................341
按钮颜色...................................................................................................................................342
WM_CTLCOLORBTN讯息...................................................................................................343
拥有者绘制按钮.......................................................................................................................344
静态类别......................................................................................................................................350
卷动列类别..................................................................................................................................352
COLORS1 程式........................................................................................................................353
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 6 页
自动键盘介面...........................................................................................................................360
视窗子类别化(Window Subclassing).................................................................................360
给背景著色...............................................................................................................................361
给卷动列和静态文字著色.......................................................................................................362
编辑类别......................................................................................................................................363
编辑类别样式...........................................................................................................................365
编辑控制项通知.......................................................................................................................366
使用编辑控制项.......................................................................................................................367
发送给编辑控制项的讯息.......................................................................................................367
清单方块类别..............................................................................................................................368
清单方块样式...........................................................................................................................369
将字串放入清单方块...............................................................................................................369
选择和取得项...........................................................................................................................370
接收来自清单方块的讯息.......................................................................................................372
一个简单的清单方块应用程式...............................................................................................372
档案列表...................................................................................................................................376
使用档案属性码.......................................................................................................................377
档案列表的排序.......................................................................................................................377
Windows 的head 程式.............................................................................................................378
第十章 功能表及其他资源..........................................................................................................384
图示、游标、字串和自订资源..................................................................................................384
将图示添加到程式...................................................................................................................385
取得图示代号...........................................................................................................................390
在程式中使用图示...................................................................................................................392
使用自订游标...........................................................................................................................393
字串资源...................................................................................................................................394
自订的资源...............................................................................................................................396
功能表..........................................................................................................................................404
功能表概念...............................................................................................................................404
功能表结构...............................................................................................................................405
定义功能表...............................................................................................................................405
在程式中引用功能表...............................................................................................................406
功能表和讯息...........................................................................................................................407
范例程式...................................................................................................................................409
功能表设计规范.......................................................................................................................415
较难的一种功能表定义方法...................................................................................................415
浮动突现式功能表...................................................................................................................417
使用系统功能表.......................................................................................................................422
改变功能表...............................................................................................................................425
其他功能表命令.......................................................................................................................425
建立功能表的非正统方法.......................................................................................................427
键盘加速键..................................................................................................................................431
为什么要使用加速键...............................................................................................................431
安排加速键的几条规则...........................................................................................................432
加速键表...................................................................................................................................433
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 7 页
加速键表的载入.......................................................................................................................433
键盘代码转换...........................................................................................................................433
接收加速键讯息.......................................................................................................................434
功能表与加速键应用程式POPPAD.......................................................................................435
启用功能表项...........................................................................................................................442
处理功能表项...........................................................................................................................442
第十一章 对话方块......................................................................................................................445
模态对话方块..............................................................................................................................445
建立「About」对话方块.........................................................................................................446
对话方块及其模板...................................................................................................................450
对话方块程序...........................................................................................................................453
启动对话方块...........................................................................................................................454
不同的主题...............................................................................................................................455
更复杂的对话方块...................................................................................................................458
使用对话方块控制项...............................................................................................................465
「OK」和「Cancel」按钮......................................................................................................468
避免使用整体变数...................................................................................................................469
Tab 停留和分组........................................................................................................................470
在对话方块上画图...................................................................................................................472
将其他函式用於对话方块.......................................................................................................473
定义自己的控制项...................................................................................................................473
非模态对话方块..........................................................................................................................480
模态对话方块与非模态对话方块的区别...............................................................................481
新的COLORS程式.................................................................................................................483
HEXCALC:视窗还是对话方块?........................................................................................488
通用对话方块..............................................................................................................................496
增强POPPAD...........................................................................................................................496
Unicode 档案I/O......................................................................................................................518
改变字体...................................................................................................................................519
搜寻与替换...............................................................................................................................520
只呼叫一个函式的Windows 程式.........................................................................................520
第十二章 剪贴簿..........................................................................................................................523
剪贴簿的简单使用......................................................................................................................523
标准剪贴簿资料格式...............................................................................................................523
记忆体配置...............................................................................................................................525
将文字传送到剪贴簿...............................................................................................................527
从剪贴簿上取得文字...............................................................................................................528
打开和关闭剪贴簿...................................................................................................................529
剪贴簿和Unicode....................................................................................................................529
复杂的剪贴簿用法......................................................................................................................535
利用多个资料项目...................................................................................................................536
延迟提出...................................................................................................................................537
自订资料格式...........................................................................................................................538
实作剪贴簿浏览器......................................................................................................................541
剪贴簿浏览器链.......................................................................................................................541
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 8 页
剪贴簿浏览器的函式和讯息...................................................................................................541
一个简单的剪贴簿浏览器.......................................................................................................544
第十三章 使用印表机..................................................................................................................548
列印入门......................................................................................................................................548
列印和背景处理.......................................................................................................................549
印表机装置内容.......................................................................................................................553
修改後的DEVCAPS程式......................................................................................................555
PrinterProperties呼叫...............................................................................................................566
检查BitBlt支援.......................................................................................................................567
最简单的列印程式...................................................................................................................568
列印图形和文字..........................................................................................................................569
列印的基本程序.......................................................................................................................573
使用放弃程序来取消列印.......................................................................................................574
Windows如何使用AbortProc.................................................................................................575
实作放弃程序...........................................................................................................................576
增加列印对话方块...................................................................................................................578
为POPPAD增加列印功能......................................................................................................583
第十四章 点阵图和BITBLT.......................................................................................................590
点阵图入门..................................................................................................................................590
点阵图的来源...........................................................................................................................591
点阵图尺寸..................................................................................................................................591
颜色和点阵图...........................................................................................................................592
实际的设备...............................................................................................................................593
GDI 支援的点阵图...................................................................................................................596
位元块传输..................................................................................................................................597
简单的BitBlt............................................................................................................................597
拉伸点阵图...............................................................................................................................601
StretchBlt模式.........................................................................................................................605
位元映射操作...........................................................................................................................605
图案Blt.....................................................................................................................................608
GDI 点阵图物件..........................................................................................................................610
建立DDB.................................................................................................................................610
点阵图位元...............................................................................................................................613
记忆体装置内容.......................................................................................................................614
载入点阵图资源.......................................................................................................................615
单色点阵图格式.......................................................................................................................619
点阵图中的画刷.......................................................................................................................622
绘制点阵图...............................................................................................................................624
阴影点阵图...............................................................................................................................629
在功能表中使用点阵图...........................................................................................................634
非矩形点阵图图像...................................................................................................................648
简单的动画...............................................................................................................................653
视窗外的点阵图.......................................................................................................................657
第十五章 与装置无关的点阵图...................................................................................................669
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 9 页
DIB档案格式..............................................................................................................................669
OS/2样式的DIB......................................................................................................................670
由下而上...................................................................................................................................673
DIB图素位元...........................................................................................................................673
扩展的Windows DIB...............................................................................................................674
真实检查...................................................................................................................................677
DIB压缩...................................................................................................................................679
颜色遮罩(COLOR MASKING)....................................................................................................681
第4 版本的Header ..................................................................................................................684
第5 版的Header ......................................................................................................................688
显示DIB资讯..........................................................................................................................690
显示和列印..................................................................................................................................698
了解DIB...................................................................................................................................698
点对点图素显示.......................................................................................................................701
DIB的颠倒世界.......................................................................................................................710
循序显示...................................................................................................................................719
缩放到合适尺寸.......................................................................................................................727
色彩转换、调色盘和显示效能...............................................................................................738
DIB和DDB的结合....................................................................................................................739
从DIB建立DDB....................................................................................................................739
从DDB到DIB........................................................................................................................747
DIB区块...................................................................................................................................748
DIB区块的其他区别...............................................................................................................756
档案映射选项...........................................................................................................................757
总结...........................................................................................................................................758
第十六章 调色盘管理器..............................................................................................................759
使用调色盘..................................................................................................................................759
视频硬体...................................................................................................................................759
显示灰阶...................................................................................................................................760
调色盘资讯...............................................................................................................................768
调色盘索引方法.......................................................................................................................769
查询调色盘支援.......................................................................................................................773
系统调色盘...............................................................................................................................774
其他调色盘函式.......................................................................................................................774
位元映射操作问题...................................................................................................................775
查看系统调色盘.......................................................................................................................776
调色盘动画..................................................................................................................................786
跳动的球...................................................................................................................................787
一个项目的调色盘动画...........................................................................................................795
工程应用程式...........................................................................................................................800
调色盘和真实世界图像..............................................................................................................805
调色盘和packed DIB..............................................................................................................805
「通用」调色盘.......................................................................................................................816
中间色调色盘...........................................................................................................................823
索引调色盘颜色.......................................................................................................................828
Programming Windows 程式开发设计指南(Windows95 程序设计 第五版)
第 10 页
调色盘和点阵图物件...............................................................................................................834
调色盘和DIB区块..................................................................................................................840
DIB处理程式库..........................................................................................................................845
DIBSTRUCT结构...................................................................................................................847
资讯函式...................................................................................................................................848
读、写图素...............................................................................................................................856
建立和转换...............................................................................................................................860
DIBHELP 表头档案和巨集.....................................................................................................873
DIBBLE程式...........................................................................................................................876
档案载入和储存.......................................................................................................................900
显示、卷动和列印...................................................................................................................900
剪贴簿.......................................................................................................................................901
翻转和旋转...............................................................................................................................901
简单调色盘;最佳化调色盘......................................................................................................902
均匀分布...................................................................................................................................916
「Popularity」演算法..............................................................................................................916
「Median Cut」演算法............................................................................................................917
转换格式......................................................................................................................................917
第十七章 文字和字体..................................................................................................................922
简单的文字输出..........................................................................................................................922
文字输出函式...........................................................................................................................922
文字的装置内容属性...............................................................................................................925
使用备用字体...........................................................................................................................926
字体的背景..................................................................................................................................927
字体型态...................................................................................................................................927
TrueType 字体..........................................................................................................................928
属性或样式...............................................................................................................................929
点值...........................................................................................................................................929
间隔和间距...............................................................................................................................929
逻辑英寸问题...........................................................................................................................930
逻辑字体......................................................................................................................................931
逻辑字体的建立和选择...........................................................................................................931
PICKFONT程式......................................................................................................................932
逻辑字体结构...........................................................................................................................950
字体映射演算法.......................................................................................................................954
取得字体资讯...........................................................................................................................955
字元集和Unicode....................................................................................................................957
EZFONT系统..........................................................................................................................958
字体的旋转...............................................................................................................................967
字体列举......................................................................................................................................969
列举函式...................................................................................................................................969
「ChooseFont」对话方块.......................................................................................................970
段落格式......................................................................................................................................979
简单文字格式...........................................................................................................................980
使用段落...................................................................................................................................981
Programming Windows
C安全编码标准【高清+页码目录+可搜索+可编辑/复制/粘贴+无密码】
一、下载须知
1、------------》用于传播和交流思想
2、------------》页码目录,不是章节目录。
3、------------》已经进行解密处理,大多数PDF会进行加密以至于无法编辑
4、------------》高清
5、------------》可直接复制粘贴源码
6、------------》可搜索某一段内容
附注:本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。仅用于交流和传播思维模式。
二、全部目录如下
目录
关于作者
前言
笫1 章本标准使用说明... …·……….. … I
系统质量............................................. I
自动生成的代码............ ........ . ... ....... ..... 1
顺应性. ...... ......................................... 2
第2 章预处理器(PRE) ...... ………... 4
建议和规则.......................................... 4
风险评估汇总......... .................... .......... 4
相关规则和建议······ · ··· · ······· ······"··.... . ... 5
PREOO-C. 用内联函数或静态函数代替与函数
相似的宏............... ........................... 5
PREOI-C. 在宏参数名两边加上括号·……….. 9
PRE02-C. 宏替换列表应该加上括号... …… JO
PR 印3-C. 应该使用typedef 定义编码
类型·················· ······ ········· ···--·· ·····11
PRE04-C. 不要复用标准头文件名………… 12
PREOS-C. 理解连接标记或执行字符串化时的
宏替换.. ..... .................. ............. .... 14
PRE06-C. 把头文件放在包含防护条件中… 15
PRE07-C. 避免使用连续的问号…………… 16
PREOS-C. 保证头文件名惟一... …………... 18
PRE09-C. 不要用不安全的函数替换安全
函数............................................. 19
PREIO-C. 在一个do-while 循环中包装
多条语句的宏. ... ..... ........................ 20
PRE30-C. 不要通过连接创建统一字符
名称.................................. ........... 22
PRE31 -C. 不要在不安全宏的参数中包含
赋值、增值、减值、volatile 访问或函
数调用.......................................... 22
第3 章声明和初始化(DCL) ……... 25
建议和规则.......... . ........... . ................ 25
风险评估汇总.................................... 25
DCL.00-C. 用const 限定不可修改的对象•.. 26
DCL.01-C. 不要在子作用域中复用变量名... 27
DC血-C. 使用视觉区别明显的标识符…… 28
DCl.03-C 使用静态断言测试常量表达式
的值, ·············· ·· ···················· ··· ·····29
DCI.04-C. 不要在一个声明中声明超过1 个
的变量,........... ... ........................... 31
DCW5-C. 使用typedef 声明提高代码的
可读性.................... . ..................... 33
DCl.06-C. 使用有意义的符号常量表示程序
逻辑中的字面值...…... ………......... … 33
DCIJY7-C. 在函数声明器中包含适当的类型
信息.............................. ..... .......... 38
DCl.08 -C. 在常量定义中对关系进行正确的
编码............................................. 4()
DCl.09-C. 把返回errno 错误代码的函数的
返回类型市明为ermo_ l · ·· …………... 42
DCLIO-C. 维护变参函数的编写者和调用者
之间的契约.................................... 44
DCLll-C. 理解与变参函数相关联的类型
问题.............................. ... ............ 46
OCL12-C. 使用不透明类型实现抽象数据
类型............................................. 47
DCL13-C. 把不会被函数修改的值指针参数
声明为C0118l ................... ................. 49
DCLl4. 不要对跨翻译单元的全局变量的
初始化顺序作出假设,..伞..... ... ………… 51
DCLl5-C. 把不需要外部链接的对象声明
为static ....................................... 52
DC巳0-C. 声明具有正确存储持久期的
对象..................... .................. ... ... 54
DCI.31-C. 在使用标识符之前声明它们…… 56
DC 口2-C. 保证相互可见的标识符是
惟一的.......................................... 58
DC巳3-C. 保证函数实参中具有限制性限定的
源指针和目标指针不引用重叠的对象... 59
DC巳4-C. 对无法缓存的数据使用
volatile .......................................... 61
DCI.35-C. 不要使用与函数定义不匹配的
类型转换函数.......... .. .......... ... ........ 63
DCL.36-C. 不要声明具有冲突链接属性的
标识符······················ ·· ··--···· ···· --··-- 65
第4 章表达式(EXP) ...... …... ......... 67
建议和规则....... .. ....... ..... .................. 67
风险评估汇总..... ..... . ......................... 67
相关的规则和建议…...………............ … 68
EXPOO-C. 使用括号保证操作的优先级...... 68
EXPOI-C. 不要用指针的长度确定它所指向
类型的长度........ . ...... ... . ................. 69
EXP02-C. 注意逻辑AND 和OR 操作符的
短路行为....................................... 71
EXP03-C. 不要认为结构的长度等于它的各个
成员的长度之和....……........ …......... 72
EXP04-C. 不要在结构之间执行逐字节的
比较... ...... ...... ........ ...... ........ .. ...... 74
EXP05-C. 不要转换掉const 限定........…·… 75
EXP06-C. sizeof 操作符的操作数不应该包含
副作用..... ... .................. .... ........ ... . 77
EXP07-C. 不要在表达式中对常量的值作出
假设而削弱常量的优点.…... 78
EXP08-C. 确保正确地使用指针运算……... 79
EXP09-C. 使用sizeof确定类戏或变量
的长度................... . ...... ..... ........... 81
EXPIO-C. 不要依赖子表达式的求值顺序或
副作用的发生顺序... …….. .. ……........ 82
EXPll-C. 不要把期待一种类型的操作符应用
于一种不兼容的类型……...... ...…...... 84
EXP12-C. 不要忽略函数的返回值…… … … 88
EXP30-C. 不要依赖序列点之间的求值
顺序.. .... ...... . ........... . ....... . ....... ..... 89
EXP'.31 、c. 避免断言的副作用..….... ... .….. 90
EXP32-C. 不要转换掉volatile 限定....…….. 91
EXP33-C. 不要引用未初始化的内存....….. 92
EXP'.34-C. 保证不对null 指针进行解引用… 96
EXP35-C. 不要在后续的序列点之后访问或
修改一个函数的调用结果中的数组...... 97
EXP'.36干C. 不要把指针转换为对齐要求更严格
的指针类型............ . ......... .. .......... .. 98
EXP'.37-C. 调用函数时使用API 所指定的
XII
参数.......... . ...... .... . ..... . ......... ..... ... 99
EXP38-C. 不要在位段成员或非法类型上
调用offsetof() .............................. JOI
第5 章整数(INT) ........................ 104
建议和规则............ ... ........ .... ........ . ... 104
风险评估汇总................. .... . .............. 104
相关的规则和建议... .. ..……................. 105
INTOO-C. 理解编译器所使用的数据
模型.............................. ... ........ . ... 105
INTOI-C. 使用rsize_ t 或size_ t 类型表示
所有表示对象长度的整数值…… · …..... 108
IN1U2-C. 理解整数转换规则...…………... 111
INT03-C. 使用安全的整数库.......……….. 114
INT04-C. 对来自不信任来源的整数值实行
限制. . .... . ... .. .... . .. ... ......... .. ..... . . .. . . . 115
INT05-C. 如果输人函数无法处理所有
可能出现的错误就不要用它们转换
字符数据... ......... .. ....... ... . .. ... ...... ... 117
INT06-C. 使用strtol() 或相关函数把字符
串标记转换为整数.... ....... ... . …......... 119
INT07-C. 只使用显式的有符号或无符号char
类型表示数值......................... . ....... 121
INT08-C. 验证所有的整数值位于
范围内........ ..... ..... .......... ........ . .. . .. 122
INT09-C. 保证枚举常量映射到惟一
的值........ . ................................. . .. 124
INTlO-C. 使用%操作符时不要假设余数
总是正的....................................... 125
INTll-C. 把指针转换为整数或者把整数
转换为指针时需要小心.. . …………...… 127
INT12-C. 当普通的整数位段用于表达式时,
不要对它的类型作出假设...... …......... 128
INT13-C. 只对无符号操作数使用位
操作符... .. ....... . ............................. 129
INTI4-C. 避免在同一个数据上执行位操作和
算术运算. ................ .. .................... 13/
INTl5-C. 在程序员定义的整数类型的格式化
l/0 中使用intmax_ t 或uintmax_ t …... 132
INT30-C. 保证无符号整数运算不产生
回绕............ .... .. . . ....... ... ...... ... ...... 135
汛f
INT31-C. 保证整型转换不会丢失或错误解释
数据......... . ........ . .. ... ........ .... ...... ... 139
INT32-C. 保证有符号整数运算不会产生
溢出. . . .......................... . ............... 142
INT33-C. 保证除法和求模运算不会导致
除零错误....................................... 149
INT34-C. 移位的数童不能是负数或大于
操作数的位数..... . ........ . .................. 150
INT35-C. 把整烈表达式比较或赋值为一种
较大类型之前用这种较大类型对它进行
求值............................................. 154
第6 章浮点数(FCP) ………………… 157
建议和规则... ...... ... .......... ..... ...... . . . . . . 157
风险评估汇总.................................... 157
相关规则和建议... .. .. .. ...... ......... .... ..... 157
FLPOO-C. 理解浮点数的限制…………······158
n的1-C. 在重新排列浮点表达式时需要
注意......... . . . ......... .. .......... . .... . ... . .. 159
FLP02-C. 需要精确计算时避免使用
浮点数.......................................... 160
FLP03-C. 检测和处理浮点错误... ... . .……· 163
FLP30-C. 不要使用浮点数作为循环
计数器·· · ···· ··· · · ····· ····.. ···--····· ......... 167
FLP31-C. 不要用复数调用期望接受实数
的函数........ . ......... . .. . ........... ... ...... 169
FLP32-C. 防止或检测数学函数中的定义域
错误和值域错误…….........……...... … 170
FLP33-C. 执行浮点运算时把整数转换为
浮点数.......................................... 175
FLP34-C. 保证浮点转换位千新类型的范围
之内... ... ...... .. . ... ...... . . . ......... ... ...... 177
第7 章数组(ARR)···…... …... …… 180
建议和规则....................................... 180
风险评估汇总... ...... ...... ... . .. ....... ... ..... 180
相关规则和建议…... ……....... ……........ 180
ARROO-C. 理解数组的工作方式………… 181
ARROI-C. 获取数组的长度时不要对指针
应用s远of操作符... ...... …...... …...... 183
ARR02-C. 显式地指定数组的边界,即使
它已经由初始化值列表隐式地指定…... 185
ARR30-C. 保证数组索引位于合法的范围
之内.... ........ .... ..... ... ... ...... ... ...... 186
ARR31-C. 在所有源文件中使用一致的数组
记法.......................................... 187
ARR32-C. 保证变长数组的长度参数位于
合法范围之内... . .. ... ....... . . ... ....... .. ... 189
ARR33-C. 保证复制的目标具有足够的存储
空间.......................................... 190
ARR34-C. 保证表达式中的数组类型是
兼容的....................................... 192
ARR35-C. 不允许循环迭代到数组尾部
之后....... .. ... ....... .. ..................... 193
ARR36-C. 不要对两个并不指向同一个
数组的指针进行相减或比较..…... ….... 195
ARR37-C. 不要把一个指向非数组对象的
指针加上或减去一个整数.. . .... .….. .. … 196
ARR38七C. 如果结果值并不引用合法的数组
元素,不要把指针加上或减去一个
整数..................... ... ... ... .... ..... ... /98
第8 章字符和字符串(STR) ……... 201
建议和规则.. . ...... ... ...... .. .. .. ... . ... .. ... ... 201
风险评估汇总.................................... 201
相关规则和建议... . . ... .... .. . ... ...... ... ... .. . 202
STROO-C. 使用适合的类型表示字符…·….. 202
STROl-C. 采纳和实现一致的字符串管理
计划............................................. 203
STR02-C. 对传递给复杂子系统的字符串
数据进行净化................... . ..... .. ...... 204
STR03-C. 不要意外地截断null 结尾的字节
字符串... ....................................... 207
STR04-C. 使用普通char 类型表示基本字符
集中的字符... . . .... .. . .. .... . .. .. .... .. .. . .... 209
STR05-C. 引用字符串常量时使用const
指针······ · · ··· ··· · ··· ··· ······ · · · · ·· ··· ··· ·--···210
STR06七. 不要以为strtok() 会使解析的
字符串不被修改... . ........….. .... ......... 21/
STR07-C. 使用TR 24731 修正现在的字符串
操纵代码............... . .... . ...... ... ... ... ... 213
STR08-C. 使用托管字符串开发新的字符串
操纵代码... ...... . ... .. ... .. . ... . . .... . ..... . .. 216
STR30-C. 不要试图修改字符串常量..... .… 217
STR3l 孛C. 保证字符串的存储具有足够的空间
容纳字符数据和null 结尾符…... ....~ …·218
STR32-C. 根据需要将字符串用null
结尾.. ............................... ... ....... .. 222
STR33-C. 正确地判断宽字符串的长度...... 225
匀、R34-C. 在转换为更大的整型长度时把字符
转换为无符号类型…………………...... 227
匀,R3S-C. 不要把未检查边界来源的数据
复制到固定长度的数组…... ... ...... ... ... 228
STR36-C. 不要指定用字符串常釐初始化的
字符数组的边界…..... .....….............. 232
STR37-C. 字符处理函数的参数必须能够用
unsigned ch盯表示...................…..... 233
第9 章内存管理(MEM) ...... ... …… 235
建议和规则.. ............... . ... . ................. 235
风险评估汇总............ . ....................... 235
相关规则和建议...…...... ……... …......... 236
MEMOO-C. 在同一个模块、同一个抽象层中
分配和释放内存.... ….............. …… 236
MEMOI-C. 在free() 之后立即在指针中
存储一个新值....................... ....... 238
MEM02-C. 把内存分配函数的词用结果立即
转换为指向被分配类型的指针… . .. ... ... 240
MEM03-C. 及时清除存储在可复用资源中
的敏感倌息·········........................ 243
MEM04-C. 不要执行零长度的分配…...... 247
MEMOS-C. 避免大型的堆栈分配·……….. 249
MEM06-C. 保证敏感数据不会被写入到
磁盘...... ... .......... .. ..................... 251
MEM07-C. 保证calloc() 的参数相乘后可以
用size_ t 表示....... ....... ... ........ .... . 254
MEMOB-C. 只把realloc() 用千改变动态分配
数组的大小................................. 255
MEM09-C. 不要假设内存分配函数会对内存
进行初始化.................... .... ......... 257
MEMIO-C. 定义和使用指针验证函数…... 259
MEM30-C. 不要访问已经被释放的内存... 261
MEM31-C. 动态分配的内存只应释放
一次··· ····........... ........................ 263
'IN
MEM32-C. 检测和处理内存分配错误...... 264
MEM33-C. 使用正确的语法表示灵活数组
成员....................... ................ ... 267
MEM34-C. 只释放动态分配的内存·…….. 269
MEM35-C. 为对象分配足够的内存……... 270
第10 章输入/输出(FLO) … …… … 274
建议和规则... . ........... .. . ...... ............... 274
风险评估汇总··· ··· ···"0·······"···············274
相关规则和建议.. ............................... 275
FIOOO-C. 在创建格式字符串时应该
小心......... .. ..... .......... .. .... . ... ...... ... 276
FIOOl-C. 调用通过文件名标识文件的函数时
必须小心............................ . .... .. .. .. 277
FI002-C. 对来自不信任来源的路径名进行
标准化........ . ................................. 279
FI003-C. 不要对£open() 和文件的创建
作出假设······ · ·························· ·· ····286
FI004-C. 检测和处理输人和输出错误·….. 288
FIOOS-C. 使用多个文件属性标识文件.. .… 290
FI006-C. 创建具有正确访问权限的
文件....... . ...................... ...... .... .. . .. 295
FI007-C. 用£seek() 代替rewind() · · · · · · · · ·297
FI008-C. 在打开的文件上调用remove()
时应该小心······················ ···· ··········299
FI009-C. 跨系统传输二进刮数据时应该
小心........................ .. .......... ... .. . ... 3()()
FIOIO-C. 使用rename() 函数时应该
小心.. .. ........ .. ...................... ...... ... 301
FIOll-C. 指定£open() 的mode 参数时应该
小心.......... ................. ... ............... 305
FJ012-C. 使用的tvbuf() 代替
眈tbuf() ...... ............. .................... 305
FI013-C. 不要压回多于1 个的字符….. .... 306
FI014-C. 理解文件流的文本模式和二进制
模式的区别......................... .. ...... ... 308
FIOlS-C. 保证文件操作在安全目录中
执行. . .... ....... .. ..................... ...... ... 309
FIOl6-C. 通过创建j幻l 限制对文件
的访问............... ...... ......... ... ....... .. 313
FI030七排除格式字符串中的用户
).)1
输入. .. ............... ... ............ ... . . .... ... 315
FI031-C. 不要打开已经被打开的文件…… 318
FI032-C. 不要在专用于文件的设备上执行
操作....... .. ................... .. ... . ..... . .... . 320
FI033-C. 检测和处理导致未定义行为的输入
输出错误······· · ··· · ····· ···· ······ · · · ····· · ···323
FI034-C. 使用int 捕捉字符VO 函数的
返回值...... ................................. ... 328
日035-C. 当sizeof (int) = = sizeof (char)
时使用feof() 和ferror() 检测文件尾和
文件错误..... ............. . . . ...... .... . . ..... . 329
F1036-C. 不要假设fgets() 会读取
换行符... .. .. .................. .. . .. ... ...... . .. 331
FI037-C. 不要假设被读取的是字符
数据·················· · ·· ··· ······ ·· ·············332
FI038-C. 不要使用FILE 对象的拷贝进行
输入和输出.... ..... ...... ... .. ... ............. 333
FI039-C. 不要在没有干预刷新或定位调用的
情况下在一个流中交替地执行输入
和输出··· ·· ······················ ··· · ·· ··· ·· ····334
F1040-C. 在fgets() 失败时重置字符串· ….. 336
FI041-C. 调用getc() 或putc() 时不要使用
具有副作用的流参数....…………........ 337
FI042-C. 保证当文件不再需要时及时将
它们关闭······ ······ ·· ············ · ······ ·--··· 339
FI043-C. 不要在共享目录中创建临时
文件......... . .. ... .................. . . . ....... .. 342
FI044-C. 只在fsetpos() 中使用fgetpos()
所返回的值..... . .......... .. .................. 350
第11 章环境(ENV)···· ··· · · ······ ······352
建议和规则···· ·· ······· ·· · ·· ·····----····· ·· ·····352
风险评估汇总. .................... .. . ... ........ . 352
相关规则和建议.. .... ... .. ...................... 352
ENVOO-C. 不要存储指向getenv() 返回的
字符串的指针.... ..... ... ..................... 352
ENVOI -C. 不要对环境变量的长度作出
假设.......................................... 357
ENV02-C. 注意具有相同有效名称的多个
环境变董......... . .. ... .................... .. .. 358
ENV03-C. 调用外部程序时对环境进行
净化............... ... ..................... ... ... 361
ENV04-C. 如果不需要命令处理器就不要
调用system() ................................. 364
ENV30-C. 不要修改getenv() 所返回的
字符串··· ·················· ······ ··· ·· ·· · ·······367
ENV31-C. 在可能无效化环境指针的操作
之后不能再依赖它.... ........………...... 369
ENV32-C. 所有的atexit 处理函数都不能以
除了正常返回之外的其他任何方式
终止... ... ............................... . ....... 373
第12 章信号(SIG) …......…...... ... 376
建议和规则......... .. . ..... ................... ... 376
风险评估汇总...... .................. ... ......... 376
相关规则和建议.... ... .. ..... ................ .. . 376
SIGOO-C. 屏蔽由不可中断的信号处理函数
所处理的信号... ....... ....................... 376
SIGOI-C. 理解与信号处理函数的持久性
有关的平台特定的细节……………….. . 379
SIG02-C. 避免使用信号实现常规的
功能... ......... ...... .. ... .. ... ................. 382
SIG30-C. 只在信号处理函数中调用异步
安全的函数.... ............... ......... .. .. .... 386
SIG31-C. 不要访问和修改信号处理函数中的
共享对象.... ...... .................. .. ...... .. . 390
SIG32-C. 不要在信号处理函数中调用
Ion印mp( ) ....................................... 392
SIG33-C. 不要递归地调用raise() 函数…… 395
SIG34-C. 不要在不可中断的信号处理函数
内部调用signal() .......................... ·398
笫13 章错误处理(ERR) ... ….... ….. 401
建议和规则.................. ...... ........ ..... .. 401
风险评估汇总...... ...... ........................ 401
相关规则和建议............................ ..... 401
ERROO-C. 采用和实现一致的、全面的错误
处理策略··············· · ········· ····· · · · · ·· ··· 402
ERRO I -C. 使用felTOr() 而不是errno 检查
FILE 流错误............ ...... ...... ... ...... 404
ERR02-C. 避免带内错误指示符.... …….. 405
ERR03-C. 调用TR24731 - I 所定义的函数时
使用运行时约束处理函数..... ....……... 408
ERR04..C. 选择一种适当的终止策略…... 410
ERROS-C. 独立千应用程序的代码应该在
不提示错误处理的情况下提供错误
检测.............................. . ........... 414
ERR06-C. 理解assert( ) 和abort () 的终止
行为... ....................................... 419
ERR30-C. 调用设置errno 的库函数之前把
enno 设置为0, 并且在函数返回一个
提示失败的值之后检查ermo ·· 一……. .. 420
ERR3 I -C. 不要重定义errno· …………….. 424
E RR32会C. 不要依赖errno 的不确定值…… 425
第14 章其他(MSC ) -…..... ……… ... 429
建议和规则... ...... .... .. ..... .... ... ...... .... .. 429
风险评估总结........ . .... .. . . ................ ... 429
MSCOO-C. 在高警告级别进行干净的
编译... .. ...... ...... . .. ... . ... ... . . .... ......... 430
MSCOI-C. 实现逻辑完整性…... …......... 430
MSC02..C. 避免因为省略所导致的错误·….. 433
MSC03 七避免因为多余所导致的错误…… 434
MSC04畴C. 用一种可读的风格一致地使用
注释............ ....... ....... ........ ........... 435
MSCOS-C. 不要直接维护time_ I 类型
的值........... . .. . .. . ............... ... ......... 437
MSC06-C. 处理敏感数据时注意编译器
的优化.......................................... 438
MSC07-C. 检测和删除死代码.... ……….. 441
MSC08 - C. 库函数应该对形参进行验证...... 443
MSC09..C. 字符编码:使用ASCII 的子集以
保证安全........... ....... ....... ...... . ... .... 445
MSCIO-C. 字符编码: UTF-8 相关
的问题.. .............. .. ... . . . ........... . ...... 44 7
MSC I I-C. 使用断言进行诊断测试……... 450
对
MSC12-C. 检测和删除没有效果的代码.. … ·451
MSC 13-C. 检测和删除未使用的值……... 452
MSCl4-C. 不要引人不必要的平台
依赖性···················· ·· ········ ·· ··········454
MSCIS-C. 不要依赖未定义的行为·…….. 455
MSC30-C. 不要使用rand() 函数产生伪随
机数··············· · ·················· ·· ··· ··· ··· 457
MSC31-C. 保证返回值与适当的类型
进行比较······· · ······· ······· ··········· ······ 459
附录POSIX (POS) · · · ………….……..如
建议和规则...... . . ... .. ..... ... .. . . ... ........... 461
风险评估汇总····································461
相关的规则和建议…... ……. ..... ...... . ..... 462
POSOO-C. 避免多线程的竞争条件…......... 462
POSO J-C. 检在链接是否存在…… …… …... 463
POS02-C. 遵循最小特权原则.. . …… . . ……· 466
POS30-C. 正确地使用readl ink() 函数……必8
P0S3I-C. 不要解锁或销毁另一个线程
的mutex······· ··· ·· · ·· ···· · ·· · ·· · · ··· · ·· • ·"·· 4 70
P0S32-C. 在多线程环境中使用位段时包含
一个mutex····················· · ··········· ··· 471
POS33 -C. 不要使用vfo众() . …………..... 473
POS34 -C. 不要用一个指向自动变量的指针为
参数调用putenv()······· …........ …..... . 475
POS35-C. 避免检查符号链接是否存在时
的竞争条件............................ . ..... .. 476
POS36 -C. 在撤消特权时注意正确的撤消
顺序....... .... . . . . ... ............... .. .......... 478
POS37-C. 保证特权的撤消是成功的..…… ·480
词汇表................................................ 484
参考资料···· ··· ·· ··· ···· · · ···· · ········· · ·· · ·········486
敏捷软件开发:原则、模式与实践【高清+可搜索+可编辑】
一、下载须知:很清楚,但是有一小部分看着有点颗粒感,我试着美化以增强更好地阅读体验,但是没有成功。
二、简单介绍一下,这本书我个人觉得写的确实很好,而且在当年大卖,在书的序言也写了,个人觉得是挺不错的一本书,这是翻译的作品,建议有能力的可以读原文,希望能有更多的人接触敏捷编程。
摘一点书上原话:
七年等待换来的经典(代序)
孟岩
Robert C. Martin 的经典著作《敏捷软件开发)) (Agile Software Developm叩)中文版面世,这是
计算机技术出版领域的一件人喜事。即使在技术图书非常繁荣的今天,本书的问世也仍然是值得广
大开发者格外留意和关注的享件。这不仅是因为它刚刚荣获2002 年度Jolt 震撼大奖,更因为这本书
本身的价值和独特魅力所孔。
三、
2.
目
录
第I 部分敏捷开发
第1 章敏捷实践.............................................2
1.1 敏捷联盟···········································3
1.2 原则···················································6
1.3 结论···················································8
参考文献.................................................... g
第2 章极限编程概述...............................……9
2.1 极限编程实践..........………..... ………··9
2.2 结论................................................. 16
参为文献.................................................. ,6
第3 章计划...………........................................ 17
3.1 初始探索······································、··I7
3.2 发布ii 划......................................... 18
3.3 迭代计划......................................... 18
3.4 任务计划......................................... 19
3.5 迭代................................................. 20
3.6 结论................................................. 20
参考文献··································................ 20
第4 章测试....................................................21
4.1 测试驱动的开发方法…·…....………·21
4.2 验收测试………......……………........... z4
4.3 结论................................................. 27
参考文献········..········································27
第5 章重构..........………....... ………........... ……18
5.1 素数产生程序.
一个简单的亟构示例……......... 令… ··29
5.2 结论................................................. 38
参考文献...…............................................ 38
第6 章一次编程实践...................................39
6.1 保龄球比赛...........……......... ……..... 39
6.2 结论................................................. 75
第II 部分敏捷设计
第7 章什么是敏捷设计....……............... ……79
7.l 软件出了什么错.....…………....... …··79
7.2 设计的臭味一腐化软1'1的气味·80
7.3 "Copy" 程序………..................…… 82
7.4 保持尽可能好的设计…...……......... g6
7.5 结论..............…······················ ……····86
参考文献···········································....... g7
第8 章单一职责原则(SRP) .................... 33
8.1 单一职责原则CSRP)····…………··88
8.2 结论................................................. 91
参考文献.................................….............. 91
第9 章开放一封闭原则(OCP) ............... 92
9.1 开放一封闭原则(OCP) ......... …··92
9.2 描述.......................................…....... 93
9.3 关键是抽象...………....... ……·…........ 93
9.4 结论............................................... 101
参考文献................................................ 10)
第10 章Liskov 替换原则(LSP)··………102
10.l Liskov 替换原则(LSP) ........... 102
10.2 个违反LSP 的简单例子......... 103
10.3 正方形和矩形,更微妙的违规... 104
10.4 一个实际的例子...……........... ….. 108
10.5 用提取公共部分的方法
代忏继承….........………........... ….. 112
10.6 启发式规则和习惯用法… ·114
10.7 结论............................................. 115
参考文献................................................ 115
第11 章依赖倒置原则(DIP) ................ 116
ll.l 依赖倒置原则(DIP) ……… ·--···116
11.2 层次化...................…................... 117
11.3 .. 个简单的例了……·…............…118
I 1.4 熔炉示例·…………............………···120
11.5 结论·….......................…···············122
参考文献.................................…............ 122
第12 章接口隔离原则(ISP) ............... …123
12.1 接口污染…......…………............. …123
12.2 分离客户就是分离接口……........ 124
12.3 接口隔离原则(ISP) ..... ………··125
12.4 类接门与对象接口…………..……·125
12.5 ATM 用户界面的例了…….......... 127
12.6 结论·······............................…....... 132
xviii 敏捷软件开发;原则、模式与实践
参考文献................................................ 132
第III部分薪水支付案例研究
第13 章COMMAND 模式和
ACTIVE OBJECT 模式..............,37
13.1 简单的COMMAND …................ 138
13.2 书务操作..................................... 139
13.3 UNDO ......................................... 140
13.4 ACTIVE OBJECT 模式…........... 141
13.5 结论·············································144
参考文献······"···· ….................................. 144
第14 章TEMPLATE METHOD 模式和
STRATEGY 模式:继承与委托·… 145
14.1 TEMPLATE METHOD 模式…···145
14.2 STRATEGY 模式………... ….... ….. 151
14.3 结论….......................................... 155
参考文献................................…………... 155
第15 章FACADE 模式和
MEDIATOR 模式.........………....... 156
15.l FACADE 模式…...........…………··156
15.2 MEDIATOR 模式……................. 157
15.3 结论.......................................••····159
参考文献................................................ 159
第16 章SINGLETON 模式和
MONOSTATE 模式··················..·160
16. l SINGLETON 模式···········……….. 161
16.2 MONOSTATE 模式·…...……....... 163
16.3 结论........................................…··169
参考文献.......、....................................... 169
第17 章NULL OBJECT 模式..............…170
17.1 结论............................................. 172
参考文献................................................ 172
第18 章薪水支付案例研究:
第一次迭代开始................….......... 73
18.l 介绍·············································l73
18.2 基于用例分析....…………·············l74
18.3 反思:我们学到f11 么……....... 180
18.4 找Ill 潜在的抽象…………............. J80
18.5 结论···································..········182
参考文献·······························•·"·············182
第19 章薪水支付案例研究:实现...........183
19.1 增加府员……········......…...... …….. 183
19.2 删除雇员….....………...... ……........ 188
19.3 时间卡、销售见条以及
服务费用..................................... ]90
19.4 更改雇员屈性......…... ….............. 196
19.5 支付雇员薪水.......………........ ….. zos
19.6 卞程序......................................... 220
19.7 数据库......................................... 221
19.8 薪水支付系统设计总结......….... 222
参芍文献················································222
第IV 部分打包薪水支付系统
第20 章包的设计原则...............................224
20.1 如何进行包的设计…....……·……·224
20.2 粒度:包的内聚件原则.......... •···225
20.3 稳定性:包的耦合性原则·227
20.4 自J顶向下设计............................. 231
20.5 稳定依赖原则.............……………·232
20.6 稳定抽象原则·……….......…·…….. z3s
20.7 结论............................................. z31
第21 章FACTORY 模式…….....................238
21.I 依赖关系环......……........ …………·239
2\.2 可替换的T厂...........…........... …·240
21.3 对测试支架使用对象U···········241
21.4 使用对象上厂有多么亟要242
21.5 结论............................................. 242
参考文献................................................ 242
第22 章薪水支付案例研究(第2 部分)
....................................................... 243
22.1 包结构和表小法…..............…….. 243
22.2 应用公共封闭原则(CCP)······245
22.3 应用甄用发布等价原则(REP)
·············································、....... 246
22.4 耦合和封装……....….. ……………... 247
22.5 度量............................................. z49
22.6 度退薪水支付应用程序250
22.7 对象工厂.............. 令令...……........ 令令.. 253
22.8 最终的包结构·…...………··········... 255
22.9 结论............................................. 256
参考文献................................................ 256
第V 部分气象站案例研究
第23 章COMPOSITE 摸式......................253
23.l 示例:组合命令·….....…...... ….... 259
23.2 多霆性还是非多默性.........……··259
第24 章OBSERVER 模式
一一回归为模式...........................261
24.1 数字时钟…........……………….... …·261
24.2 结论···························•·················275
24.3 OBSERVER 校式……········………·275
参考文献................................................ 277
第25 章ABSTRACT SF.RVER 模式、ADAPTER
模式和BRIDGE 摸式.....................278
25.l ABSTRACT SERVER 模式········279
25.2 ADAPTER 模式.. ……··········· 令… ··279
25.3 BRIDGE 模式…..……..... ….. …..... 283
25.4 结论·…................................. ••······285
参考文献················································285
第26 章PROXY 摸式和STAIRWAY TO
HEAVEN 模式:管理第三方API----286
26.l PROXY 模式…….....…......... …….. 286
26.2 STAIRWAY TO HEAVEN 栈式...…303
26.3 可以用千数据库的其他侠式...... 309
26.4 结论··········--··················• .............. 310
参考文献................................................ 310
第27 章案例研究气象站.......................311
27.l Cloud 公司..................……………·311
27 .2 Nimbus-LC 软件设计·…….......... 313
27.3 结论·············································333
参击义献······················.. ························333
27.4 Nimbus-LC 需求概述……....……·333
27.5 Nimbus士LC 用例…………............. 334
27.6 Nimbus-LC 发布计划....…..... …··336
第V1部分ETS 案例研究
第28 章VISITOR 模式········….......... …······340
28.1 VISITOR 设计模式系列......……·340
28.2 VISITOR 模式…......................... 340
28.3 ACYCLIC VISITOR 松式.......... 344
28.4 DECORATOR 校式....令令.............. 353
28.5 EXTENSION OBJECT 校式...... 358
目录xix
28.6 结论··········.. ·······.......................... 367
参考文献................................................ 367
第29 章STATE 摸式..................................363
29.l 有限状态自动机概述….......……·368
29.2 实现技术.....…····· …... …........ 令······369
29.3 STATE 模式…………….........…·····374
29.4 应该在哪些地方使用状态机...... 379
29.5 作为GUI 中的高层应用策略.... 379
29.6 结论·············································382
29.7 程序·············································382
参考文献........…···············.. ······--············388
第30 章ETS 框架..........令..........令..……...... …389
30.1 介绍·············································389
30.2 框架............................................. 392
30.3 框架设计....... 令......令……… ·············394
30.4 TEMPLATE METHOD 模式的
-个例子·····································399
30.5 TASKMASTER 构架…………...... 407
30.6 结论························..···················410
参考文献············································..··410
附录
附录A UML 表示法I: CGI 示例…....…4ll
A.L 课程登记系统:问题描述……·····412
A.2 小结······························.. ········.. ····431
参考文献........................…..................... 431
附录B UML 表示法JI:
统计多路复用器.........参····················432
B.l 统计多路复用器的定义………...…432
B.2 结论··············....·•··························448
参考文献.....…······· …………..................... 44g
附录C 两个公司的讽刺小品.....................449
附录D 源代码就是设计·……......................459
索引..............................................…, .... -... ·······467
设计模式列表
霖笃~::c~~尸......:.............:................二......:...: ..: 勹骂
笠芦尸I.~~~::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::~;:
BRIDGE···········.. ············.. ···········.. ···········..................................................... 283
2。它。:::~·:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::二::.:..::.昙
盓E飞勹芷飞~~~~;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::二二..二:.器
芦芷飞...:..:..:......:.:......::..:.:....:...:........:..:........:::.........:.:........:.::::...臣
MEDIATOR ................................................................................................... 157
MONOSTATE ................................................................................................ 163
芦s勹~~!:.~:丁:.:.:...::::..:...:.::....:.:.:.:.::..:.:....::.:..::::.::....::::.:::.::::::.::::::::.:.:.. 芦
PROXY····........ ··························································································286
SlNGLETON····································································、............................. 161 STAIRWAY TO HEAVEN ................................................................................. 303
STATE·························.. ····················.. ·• .. ·······... ·......................................... 374
STRATEGY·············································································....、................. 151
TTAESMIP也LATSTEE RM···E··T··H··O··D::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::410457
VISITOR··································.. ·······························"·······"·······、................. 340
Test-Driven+Development+By+Example-测试驱动开发【高清+有目录+可搜索+可编辑】
1.敏捷开发强调测试先行,因为先编写测试代码,就可以有目的的预防某些bug的产生,要知道,治病不如预防!!!所以我个人觉得这个还是比较重要的,文件也不大,只有8M,但是高清。
2.本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。 部分目录如下:
目录
第一部分资金实例
第1 章多币种资金··························································································································3
第2 章变质的对象························································································································10
第3 章一切均等····························································································································13
第4 章私有性·································································································............................... 16
第5 章法郎在诉说........................................................................................................................ 18
第6 章再谈一切均等.................................................................................................................... 21
第7 章苹果和桔子........................................................................................................................ 25
第8 章制造对象····························································································································27
第9 章我们所处的时代................................................................................................................ 31
第10 章有趣的Times 方法.…....….. …... …..... ….. ….... …... ….. ……….... …... ….. …….... ……... ……...... 36
第11 章万恶之源.......................................................................................................................... 41
第12 章加法,最后的部分..…..….. ….... …... ….... …..... …... ….. ….. …..... ….. …... …....... ……………· ….. 44
第13 章完成预期目标.................................................................................................................. 48
第14 章变化.................................................................................................................................. 53
第15 章混合货币.......................................................................................................................... 57
第16 章抽象,最后的工作.......................................................................................................... 61
第17 章资金实例回顾.................................................................................................................. 65
.
下一步是什么? •••••••••••·••••••••• 暹···········…...... 匿·…... …......... 霉.........…········· 暹....….. 查......................... 65
比喻66
JUnit 的向.法::::::::::::鲁....愈::::::::::::::::::::::::::::::::::::::::::::::::::::董:::::::::::::::::::::::::::::::::::::::::::::::::::::::66
代码统计.......................................... 夔················…................................................................ 麟..... 67
过程............................................................................................................................................ 68
了:回顾:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
第二部分xUnit 实例
第18 章步入xUnit ......................................... 簪.........…......... …....... ….... …..................................... 73
第19 章设置表格··················--.. ·········.. ··••• 暹........... 薹··································"······"·····…................... 77
第20 章后期整理................. 畛················............................................................ 爹...参................….... 80
第21 章计数.......................................................................................…................................... ….. 83
第22 章失败处理.......................................…... 窜........….. ….............................. ….. ….... …............... 86
第23 章如何组成一组测试...........雪…………………..………………………………………….. 霞...…………….. 88
第24 章xUnit 回顾.............雪...... 暹........... 匿········ 摹…················--雹............ …............ 霉….........…............. 93
第三部分测试驱动开发的模式
第25 章测试驱动开发模式会....................…........... 吻.....……..... ……....... 诊....………………………......... 97
测试(名词)暹.雪.... 雪......................…......................................... 崎................................................. 97
相互独立的测试(Isolated Test) ……..... …·…….......... …………………………...... …………….... 雀..... 98
测试列表(Test List) ................................................... 豪....................…..... …........................... 99
测试优先(Test First)
断言优先 (Assert First;·::::::::::::::::::::::二 ::::::::::::::::::::神: ....:::...:.......二二厂::::厂厂
100
101
测试数据(Test Data)
.显然数据(Evident Dat~·;··:::::::::::::::::::::::::::::::::::::: 二二:::::::::::::::::::::::::::::::::::::::::::…:::::
102
103
第26 章不可运行状态模式104
一步测试(One Step Test)··:::::::::: 二:....:..:墓:::::::二:厂二二二::::::::::: 二勹二二::..二二:: 104
启动测试(Starter Test) ................................... 金.......…·······....................... 渗........................... 105
说明测试<Explanation Test) 106
学习测试(Leaming Test) .... 二二二二二二二二二二二二二二二二二二二二二二二: 106
另外的测试
回归测试(;~鲁酝已卢;比~~;噜:::::::::::::: 二..二:.:二二二二二二:.二:::::::::::::::::::::::::::: 108
107
::开 闷:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::缴:惫::::::::::
便宜的桌子,舒适的椅子…………........……·…………………· ……………..... …………………………... 110
第27 章测试模式................…........ ….......................... 愈............................................................... 111
子测试(Child Test) .......... 筝.............….................................... 噙.............................................. 111
模拟对象(Mock Object) . …...... 摹.......………………·……………………………………………………· …111
:::1言lf(:n~~~~·;···::::::::::二::::::::::::::::::::::::::::::::::::::::::::::: 二::.二:.:.. :::....}}:
清扫割试死角(Crash Test Dummy) . ……... ………· ……………... ……….. …………......... …….. ….. 114
昙需它需心为芯芯;沁五::::::::::::::::::::::::::::::::::::睿 ......查::::::::::::::::::::::::::::::::::::::::::: :~!
第2~伪!:~昙,~:动了二::.二:./.二:.二二二:...::二二:/二三:.靡:...二::::::::::::::::: !!;
三角法(Triangulation) .... 暹........ 参...................................................................佛....................... 119
显明实现(Obvious Impl ementatlon) ….................... 拳...............................…......................... 119
从一到多(One to Many) ........................................ …....... 匿.............….................................. 120
第29 章xUnit 模式
断言 (Assertion).. 二二二.二二二::::.二:::::::::::::::::::::::::看 :.:..令:::::::::::::::::::::::::::::::::::::::
122
122
固定设施(Fixture) ............................................................................................................... 123
;古婴:哼宁:st(贮笠:飞F~~~~~-~...:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ~ 芦
异常测试(Exception Test) . …... ……....... …....... ………... …............... 争............. …·鲁............. 令奄.... 127
全部测试(All Tests) ..................... 耄..令......................................... 伞......................................... 127
第 3~命:巴尸尸式..:. .::.: ..: :::.,二:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ;~~
值对象簪............... 逾............................ 雪... 潭.................................................................................... 131
盓:去:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ~!!
插入式对象
插入式选择霹:::::: 二::::::::::::::::::::::令: ........:噜:::::::::::::::::::::::::::::::::::::::::::::::::::::::::135
134
工厂方法.................................... 参·········"···········...........................................噜..............….......... 137
递归:::::::::参::::::::::::::::::::::::::::::::::::::::::参:::::::::::::::::::::::::::::::::::睿...集:::::::::::::::::::::::::::::::: :~;
收集参数
单例模式亭~~-;心如~;--·::::::::二二:.二二二二二二二二二二二二二二:.. :.二:../...:
140
141
第31 章重构........................................................................................................................…..... 142
调和差异( Reconcile Differences) . …………………….. ……………………........ 萼..........……….. …... 142
隔离变化(Isolate Change) 帚...……………………........ …...... ……………... …………· …….. ………….. 143
:芯:亡::~!:~~==~;··::: 勹....勹勹:::::::二/..::/厂:.二:::::::::二二二二二二:..:::::
;芯之笘:芦::兄芯立立e)鲁·:参:.:.:.:食::::::::: 俺.. :..:二:::::::::::::::::::::::: 二:参:..二::::::::::::::: 二.::::..:芯
转移方法(Move Method) ………· ….. ……..... ……….... ………..... ………............. ………………....... 147
方法对象(Method Object) .. …………· ……….. ……………......... ……………….... …………………….. 148
添加参数(Add Parameter) …….. ….. ……………………………..... ……………..... ……………..... ….... 149
把方法中的参数转变为构造函数中的参数••• 重..............................................……....... …........ 149
第32 章掌握TDD ….....…….. ……..... ………….. ……………………...... ……………………………….. …... 夸... 150
附录沁尸尸严:::::::::::::::::::::::::::::::::睿 :.二:::::::::: 二:.:::二:.二:::.:.:::..::.::.:.::::.:..::::.二.:::::二二:.:::二腐
附录B 斐波纳契数列.…………·.........·….. …………....... ·······………….. 睿... 夸................. ….............. 食摩.. 164
高效程序员的45个习惯:敏捷开发修炼之道【有目录+可搜索+可编辑】
本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。 部分目录如下:
目录
第1 章
第2 章
敏捷高效软件开发之道.... ……矗.. 1
态度决定一切…. ...... .. . ................. 命. . ... . 10
1 做卓-·· · · · ·,,. ·.. · · · · · · · · · · ·.. · ·.. · ·.. · ·.. · ·.. · ·... · · · · · · · ·.. · · ·.. · · 12
2 欲速则不达••• •·O O O O O .. O OO .. O . ... . .. • • •~• . .. O• •• o • O • • ••O • H , - , O 15
3 对事不对人. . ....................... 一一...... . ... . ... . -~•.•····· 18
4 排除万难,奋勇前进…........…... …......... \,---· 23
第3 章学无止境''" 一一.一. .飞. - ••••••••••• •••••••••••• ••• …·…·26
5 跟踪变化……- · · ·…......... …令.... .-.-•............ 矗... . ... . 28
6 对团队投资..…••• ••• • ••• r………·会··~··阜T• ~.,••令.....…31
22 自动验收测试................................... , ..... ... . 90
23 度量真实的进度...... .~ ….. …......... …............. 93
24 倾听用户的声音....主叠..... .. .......... .. .. .....……… 96
第6 章敏捷编码............. . . ..... . . …..... ……·……… 98
25 代码要消晰地表达意图..........……..... ….... 100
26 用代码沟通..…........ ………................. 今.. ..... 105
27 动态评估取舍.. ..…..... ……· ……..... …· • · ·.• · · ·.. 11 0
28 增量式编程..... -·............ -~-........... 主...…........ 113
29 保持简单·…... …亨……......... ........噜. .. ... ..气... .. .. . 11 S
7 懂得丢弃. ;; ......... 屯箭:-, ......... 干子..... .. 妒••n.,,o、3 4
8 打破砂锅问到底.... 匕.`二. ....` . .`.... . 上已,.,.,n.. •••-• 37
9 把捏开发节奏·….... …、.·,.. ·s •• ca.·... ••• …..... 参.. .... . ... 40
第4 章交付用户想要的软件...…·…... 曹曹......... 43
10 让客户做决定...…….......................... …….... 45
11 让设计指导而不是操纵开发.......... ., …….... 48
12 合理地使用技术·………....…...... ··.·• ………..... 52
13 保持可以发布…….......……………...... 臀......…· 55
14 提早集成,频繁集成....垒......……………....... 58
15 提早实现自动化部署.... ... 入' . ..、..... ... . ... . ...…61
16 使用演示获得频繁反馈..... .. .……... ….. ….... 64
17 使用短迭代,增量发布..…….......... …; ..••... 69
l& 固定的价格就意味老背叛承诺………. ..….. 73
第5 章敏捷反馈·.... . .......... .............................. 76
19 守护天使. .... . .. .. . ..……....... …............ …...... …78
20 先用它再实现它......... 今........ . ... .. ..........……·82
21 不同环境,就有不同问题........ .峰…… ..……·87
30 编写内聚的代码·····-·..;.·/ .,.·-.'.;,_; ············......... 亨.. .... lJ7
311 告知, 不要询问....……... …….... ~,_ ...... …, •. 121
32 根据契约进行替换.......... . ........ ... ..…........ 124
第7 章敏捷调试.. . .....…........ ………......... 一.. 128
33 记录问题解决日志.. ... ...... .... .…........ …….. 129
34 警告就是错误··· ·············· "•·:... ·••• …·········"··· 132
35 对问题各个击破…·… .. .. 曹. ..... ...... 鲁· ·· ·· ·~···· ··· 136
36 报告所有的异常....…... … .... . .... . 、..... .. .. ..... .. 139
37 提供有用的错误信息.. .…….......... ………... 141
第8 章敏捷协作....................•.... ••,• ................ . 146
38 定期安排会面时间........... . .…·.. ·... •••• • ~-· •••• 148
39 架构师必须写代码.....….. …….. …………..... 152
40 实行代码集体所有制… ……...…………….: .. 155
41 成为指导者…、…………...... ..……·.~ ……·…….. 151
42 允许大家自己想办法 . . .;•. .,; ...................... .. 160
43 准备好后再共享代码·………..……...... ….... 162
44 做代码复查.•·• ……………….. …·……………….. 165
2 目录
45 及时通报进展与问题.. ... .. ..、.. .... . . .-.-. 一.... .. 妒~. .. 168
第9 章尾声:走向敏捷..…...... …................. 170
9.1 只要一个新的习惯….. ..……................... a_ l 70
9.2 拯救濒临失败的项目..…..... 八········· ·· ·· · ··.. 171
9.3 引入敏捷管理者指南.... ...………·……... 172
9.4 引入敏捷;程序员指南…. .....……........... 174
9.5 结束了吗... .... ....…·…..... …….......... …········175
附录A 资源一·.·. .;.•- ., -:俨 ~-• •• ••• ………........ …·…: ......... 176
索弓, .... 牟............_•• • 令-~······ ····..··· ···........... …......今 ... ....... 182
mq产品对比
已经将扫描的页面转化为可搜索的图像(精确)
[深入浅出-HTML5编程]Head.First.HTML5.Programming.{Eric.Freeman.&.Elisabeth.Robson}.影印版
Your brain on HTML5 Programming. Here you are trying to learn
something, while here your brain is doing you a favor by making sure the learning
doesn’t stick. Your brain’s thinking, “Better leave room for more important things,
like which wild animals to avoid and whether naked snowboarding is a bad idea.” So
how do you trick your brain into thinking that your life depends on knowing HTML5
and JavaScript?
Intro
Who is this book for? xxii
We know what you’re thinking xxiii
And we know what your brain is thinking xxiii
Metacognition: thinking about thinking xxv
The technical review team xxx
Acknowledgments xxxi
[Head First C# 中文版].斯泰尔曼.扫描版【有目录】
目录:
I C#助你快速开发: 10分钟(甚至更短时间)内轻松搞定可视化应用I .
2 都只是代码:幕后的故事43
3 对象我们的方向!让代码更合理85
4 类型与引用:现在是上午10:00, 你知道你的数据在哪儿吗? 123
C#实验室I: 赛狗日163
5 封装:让你的隐私……属千你个人173
6 继承:对象的家庭树205
7 接口与抽象类:让类信守承诺251
8 枚举与集成:存储大昼数据309
C#实验室2: 冒险游戏
9 读写文件:保存了字节数组,就留住了一切
10 异常处理:救火太老套
II 事件与委托:没有你的监视,代码自己在做什么
12 复习与预习:知识,能力,动手实践
13 控件与图片: 应用的美化
14 CAPTA1N AMAZING: 对象之死
15 LINQ: 让数据在你的掌控之中
C#实验室3: 入侵者
附录i 其他
详细巨录
引子
363
385
439
483
515
563
621
653
681
703
[Head.First.JavaScript].Michael.Morrison...
下载须知:英文版,但是内容是真的清楚,超清.......
Reacting to the Virtual World 1 Tired of thinking of the Web in terms of passive pages?
Been there, done that. They’re called books. And they’re good for reading, learning...
lots of good things. But they’re not interactive. And neither is the Web without a
little help from JavaScript. Sure, you can submit a form and maybe do a trick here
and there with some crafty HTML and CSS coding, but you’re really just playing
Weekend at Bernie’s propping up a lifeless web page. Real live interactivity requires
a bit more smarts and a little more work... but it has a much bigger payoff.
the interactive web
(Online) people have needs 2
Like talking to a brick wall... nothing happens 3
But JavaScript talks back 4
Lights, camera, interaction! 6
Use the [removed] tag to tell the browser you’re writing JavaScript 11
Your web browser can handle HTML, CSS, AND JavaScript 12
Man’s virtual best friend... needs YOUR help 15
Making iRock interactive 16
Create the iRock web page 17
Test drive 17
JavaScript events: giving the iRock a voice 18
Alerting the user with a function 19
Add the iRock greeting 20
Now let’s make the iRock really interactive 22
Interaction is TWO-way communication 23
Add a function to get the user’s name 24
Instant replay: what just happened? 27
Test drive iRock 1.0 28
table of contents
xi
Everything Has Its Place 2 In the real world, people often overlook the importance of
having a place to store all their stuff. Not so in JavaScript. You simply
don’t have the luxury of walk-in closets and three-car garages. In JavaScript, everything
has its place, and it’s your job to make sure of it. The issue is data—how to represent it,
how to store it, and how to find it once you’ve put it somewhere. As a JavaScript storage
specialist, you’ll be able to take a cluttered room of JavaScript data and impose your will
on it with a flurry of virtual labels and storage bins.
storing data
Your scripts can store data 34
Scripts think in data types 35
Constants stay the SAME, variables can CHANGE 40
Variables start out without a value 44
Initialize a variable with “=” 45
Constants are resistant to change 46
What’s in a name? 50
Legal and illegal variable and constant names 51
Variable names often use CamelCase 52
Plan the Duncan’s Donuts web page 56
A first take at the donut calculations 58
Initialize your data...or else 61
NaN is NOT a number 62
You can add more than numbers 64
parseInt() and parseFloat() convert text to a number 65
Why are extra donuts being ordered? 66
Duncan discovers donut espionage 70
Use getElementById() to grab form data 71
Validate the web form’s data 72
Strive for intuitive user input 77
TrafficMonitor
在windows的任务栏显示上传下载网速,以及内存和CPU的使用情况。简介方便。
sublime+注册码
亲测可用,window下版本,附带注册码。,很简介方便的一款编辑器。
游戏人工智能编程精粹【目录+可搜索+可编辑】
本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。 全部目录如下:
第1 农数学和物理学初探
1.1 数学····································································································2
1.2 物理学······························································································19
1.3 总结··································································································27
第2 章状态驱动智能体设计
2.1 11 么是有限状态机··········································································31
2.2 有限状态机的实现........................................ …... …......... …..... …..... 32
2.3 West World 项目···············································································36
2.4 使State 基类可重用····················· …................................................ 45
2.5 令局状态和状态翻转(State Blip) ……·……………………………………… 45
2.6 创建一个StateMachine 类..........…·················································46
2.7 弓I 入Elsa··························································································49
2.8 为你的FSM 增加消息功能............................................................ 50
第3 章如何创建自治的可移动游戏智能体
3.1 11 么是自治智能体··················"······················································64
3.2 交通工具模型.................................................................................. 65
3.3 更新交通丁-贝物理属性.. …... …....................................................... 67
3.4 操控行为.......................................................................................... 68
3.5 组行为(Group Behaviors) ........................................................... 86
3.6 组合操控行为(Combining Steering Behaviors) …………………… 91
3.7 确保无重叠...................................................................................... 96
3.8 应对大倡交通工具:空间划分………............ ….... ……... ……….. …… 97
3.9 平滑................................................................................................ 101
第4 章体育模拟(简单足球)
4.1 简单足球的环境和规则............... …........................... …..... …· …····104
4.2 设计AI ............................................................................................ 111
4.3 使用估算和假设............................................................................ 146
2
4.4 总结................................................................................................................................. 146
第5 农图的秘密生命:: 勹现一个图类~~~
5.3 图搜索算法..................................................................................................................... 161
5.4 总结................................................................................................................................. 186
第6 农用脚本,还是不用?这是一个问题
6.1 什么是脚木语言............................................................................................................ 188
6.2 脚木语言能为你做些什么............................................................................................ 189
6.3 在Lua 中编写脚本........................................................................................................ 192
6.4 创建一个脚本化的有限状态自动机..……... ….... …………………………………………………·216
6.5 有用的链接..................................................................................................................... 221
6.6 丿f 个是一切都这么美妙................................................................................................ 221
6.7 总结.................................................................................................................................. 222
绾7 农概览《掠夺者〉游戏
7.1 关于这个游戏................................................................................................................ 224
7.2 游戏体系结构概述........................................................................................................ 225
7.3 触发器............................................................................................................................. 230
:: ;~ 言向考虑:::
7.6 总结................................................................................................................................. 252
第8 农实用路径规划
8.1 构建导航图..................................................................................................................... 254
::二二:导航图:::
8.4 节点式路径或边式路径................................................................................................ 265
8.5 走出困境状态................................................................................................................ 282
8.6 总结................................................................................................................................. 284
第9 章日标驱动智能体行为
9.1 勇I 埃里克的归来........................................................................................................ 287
9.2 实现................................................................................................................................. 288
9.3 《掠夺者》角色所使用的H 标例了..…...............….. …...................... …................. …... 292
9.4 目标仲裁......................................................................................................................... 301
3
::: ~:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: !~:
纳10 章揆糊逻辑
JO.I 普通集合....................................................................................................................... 317
口::二:变倡昙
10.4 模糊规则....................................................................................................................... 322
10.5 从理论到应用:给一个模糊逻辑模块编码……………·……………......……·……………… 331
10.6 《掠夺者》中是如何使用模糊逻辑类的………………..………………..... ….. …............... 343
10.7 库博方法....................................................................................................................... 344
10.8 总结............................................................................................................................... 347
拔............................................................................................: ........................................... 349
附录A C++揆板
函数模板.................................................................................................................................. 352 : :: 的困惑昙
附录B UML 类图
已言::.;·::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: !!!
关系·····················............................, ...................................................................................... 359
扂:::
附录C 设置你的开发环境
下载演示的可执行程序.......…....................................... …................. …................................. 366
下载并安装源{飞码................................................................................................................. 366
参考文献.................................................................................................................................. 367
3D游戏.卷2.动画与高级实时渲染技术有【目录+可搜索+可编辑】
本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。 部分目录如下:
出版者的话
专家指导委员会
译者序
前言
第一部分高级游戏系统剖析
第1 章高级游戏系统剖析I : 构造过程
和静态光照... .. . . . . . .. .. . ... ... ... . .. ... I
J. I 数据结构... . . . .. . . . . ... .. . . .. ... ... . . . ... . .. ... I
I. I. I 顶点. .. ... ... ... ... ... ... ... ... .. . ... ... ... I
I. I . 2 面· ··· · ·············· ········ ··········· · · · ·2
1.1.3 包围盒·· ········ ············ ·· · ··· · ·· ·····4
1.2 构造过程····· ···· ····· ···· · ····· ······· · ··· ····4
1.2.1 从场景几何中创建BS? 树… ········4
1.2.2 路径规划的凸体和PVS 计算… ······II
1.2.3 处理复杂的地形... …...... …... ··· ···13
1.2.4 BSP 叶节点中的面... ·· ···· ...... ······16
1.2.5 寻找叶凸休....................... . ······16
1.2.6 凸体和伪人口. . .... . .. .. .. ........... . . . 19
1.2.7 潜在可视集······························24
I .3 光照贴图的构造···· · ··········· · · ········· ···28
1.3. I 生成光照贴图的坐标····· · ……...... 28
1.3 .2 光照贴图的打包..... . ...............… 29
1.3.3 对光照贴图的解释·····················30
1.4 BSP 管理....... . ............................... 31
1.5 商级静态光照一辐射度…... …...... … 37
附录1.1 构造实践·· · ········· ··· ··· ············49
附录1.2 辐射度理论基础········· …······ ··· 64
第2 章高级游戏系统剖析0: 实时
处理. ..... . .... . .. ............、... . . . ... ... 69
2.1 视见和BSP······ ········· ·····················69
2. I. I 生成视见约束体的面…... ……...... 69
2.1.2 远近裁剪面和视见约束体…… · · ····75
2.2 照相机控制············· · ·· ··· · ·· ·········· ··· ·77
2 .3 使用BSP 的基本碰撞检测和反弹…..…·80
2.3.1 碰擅和BSP 遇历…...…………... … 80
2.3.2 粒子1场景检测和反弹.. ... .... .. .. .. 81
2 .4 特殊的碰撞检测和反弹........... ... . …... 83
2.4. 1 AABB 的定义···························84
2.4.2 AABB 类的定义和静态成员的
定义· ···· ······· · ············ · ···· · ·· .. ····84
2.4.3 碰撞检测和碰撞反弹….. . …......... 86
2.4.4 使用AABB 的伪碰撞反弹… ······· ·· 87
2.4.5 使用AABB 的碰撞检测…...... …... 88
2.4.6 AABB 顶点与场景面相交............ 89
2.4.7 场景顶点与AABB 面相交...... …... 90
2.4.8 AABB 边与场景边相交……... …... 92
2.4.9 更精确的碰撞检测……········· …... 95
2 .4.10 使用碰撞阙值...… ···· ··· ···········95
2.5 基本的路径规划······················· ·· ·····96
附录2.1 实时处理的演示. . ... .舍... .. ……... 102
第3 章高级游戏系统剖析III : 软件
设计与应用编程… .... .. . .. ……... 105
3.1 应用的种类··········· ······· · ··· ···········105
3. 1.1 插件········· ···············............ 105
3.1.2 前端······... ·•· •·•·•·•. •..•.......• •• .. 111
3 . 1.3 工具··· ··· ··· ··· ··· ··· ··· ··· ···... ··· ···I 15
3 .2 Fly3 D 引擎体系结构. . ........... . .. ... . ... . 115
3 . 2 I Fly Math· · · · · · · · · · · · · · · · · • · · · 115
3. 2 . 2 FlyDirectX· · · · ·· · · · · ·· · · · · ·· · · · · · · · · · · · ·JJ6
3.2.3 FlyRender······························118
3.2.4 FlyEngine··········· · ··················120
附录3. I 编写一个插件...…............ …... 130
第二部分实时渲染
第4 章实时渲染· ··· · ········ · · ··· •·••··.••••. 145
4 :1 简介............... ······......... ... ......... 145
4.2 顶点像素和贴图·· ······· …······ ...... ... 1必
4 .2. l 基本的逐像素着色……... ……... 1拓
4 .2 .2 着色和坐标空间……•.• • ……...... /48
4.2 .3 25 年来主流的插值着色方法
和颜色贴图···················· ·· · ····149
4.2.4 标量表示······························151
w
4.3 因式分解法... .. .... ······.................. 156
4.3.1 使用因式分解着色模型的逐像素
着色-~各向同性模型...…... … 157
4.3.2 使用因式分解着色模型的逐像素
着色一各向异性模型... . ..…… 162
4.4 BRDF 和真实材质············ ········ ·· · · ·· · 164
4.5 使用BRDF 进行逐像素着色... ... …... 167
4.6 环境贴图参数化. . ......................... 170
4.6.1 环境贴图参数化: 立方映射...…… 170
4.6.2 环境贴图参数化:球面映射……... 171
4.6.3 环境贴图参数化:对偶抛物面
贴图······ ······· · ···· · ········....... .. 174
4.6.4 环境贴图一可比点............… 176
4.6.5 立方贴图和向量规范化……. . .... 177
4.7 实现BRDF: 可分离的近似······.· ·· …... 177
4.8 着色语言和着色器········· · ··· ·· …...... 181
4 .8 . I 着色语言:简单的历史回顾….. … 181
4 . 8 . 2 RenderMan 着色语音·· ·· ········ …... 182
4 .8.3 实时渲染的着色语百... ……... ... 184
第5 章实时渲染:实践................. .... 192
5. I 基本着色器....... .................. . .... ... 192
5 . I. I 渲染状态. . .. . ............. ······:·····192
5.1.2 着色器排序....... . .... · ··· ·· ··· ······193
5 .1.3 着色器类的实现..... ...... . ......... 195
5.2 渲染状态·····•·" '.... ...... . .. ............. 196
5.2.1 全局设定........... .. ....... .... .... . . 196
5.2.2 局部设定... ·· ·· ·········· · · ·· ·· ·······196
5.3 着色器实例.... . ............... .. .. .. .. .. .. . 200
5.3.1 环境映射和恪映射效果一一
玻璃、金属和铭... ... . ...... ........... 201
5 .3 .2 移动发光告示牌. .. ......…·········202
5 .3.3 简单栅栏效果...…...…... …...... 203
5.3.4 高级栅栏效果............……...... 203
5.3.5 监视器效果· · ··············· ·········· 204
5.4 实时硬件渲染············· · · ···············207
5 .4.1 顶点编程.. . .. ... . .. ............... ... . 207
5.4.2 像素编程.... ... ... . . .. .... . ........ . .. 219
5.4.3 使用寄存结合器的像素编程..…·219
5 .4 4 纹理地址编程……… 223
5.4 .5 纹理地址编程一—Phong 映射·… . . 224
5.4.6 顶点和像素编程以及多步
蓿色器·········· ·· · ···· · ··········· · · ··224
5.5 动态纹理········· ······ ············ ·· ·· · ····224
5.6 特效......... ... . ...... .... . ........ .. . . .... . . 228
5 .6.1 燃烧尾迹............... .... ........ . .. 228
5.6.2 加速器.............. . ................ . . 230
5.6.3 脉冲星... ...... .. ......... . .......... .. 230.
附录5.1 使用和探索着色器...……… . . .… 233
附录5.2 NVIDIA GeFotce 3 上的顶点
编程· ······ ··························"·235
附录5.3 NVIDIA 寄存结合器操作..... .. ..… 237
第6 章几何处理...... . ... . ....... ......... ... 240
6 .1 简介·· ······ · ··· ·"0"'0'"0"''00············240
6 2 推动因素和定义...…… 241
6 .2 .1 离线和实时阶段·········· · ·.. ... , ... 241
6 .2 .2 拓扑因素............ ... . ... ........... 242
6.2.3 离散简化与连续简化... ……...... 242
6.2.4 物体内部分辨率变化.. .……...… 243
6.2.5 对称性/可逆性........... ... ...... .... 243
6.2.6 局部简化操作..................... . . . 243
6 3 排序(误差)标准...…….. . 244
6.3.1 排序标准一外观相似………… 244
6.3.2 排序标准一一局部体积不变.... . . 245
6.3.3 排序标准一二次误差度量. . … ·246
6.3.4 排序标准一简化外壳.. .... …... 247
6.4 简化与属性..... . ........ .. ................. 2岱
6.4 :1 简化与游戏纹理.................... . 250
6.4.2 简化和蒙皮模型...…........... .... 250
6.4.3 算法框架.. . ..... .. . ...... ... . ... . . .... 250
6.4.4 顶点去除算法的重新三角形
划分.... . ... ...... ...... . ........... . ... 251
6.5 实例分析..... ...... .. .......... ............. 252
6.5. I 实例分析)一一渐近式网格
技术.............. . ..................... 252
6.5 . 2 实例分析2一使用微分几何…. . . 256
6.5.3 实例分析3一网格重新划分
算法MAPS ......... ........ . ......... 260
附录6.1 数学背景............ …..... .... ...... 264
附录6.2 演示..... . ....... . . ..................... 269
第三部分动画制作
第7 章角色动画...... ........................ 271
7. I 简介.. . ............ ........................... 271
7.2 顶点动画与合成........ . .. ................ 274
7.3 骨架动画. .. ....... . .... . . .. ........... ...... 279
[AI游戏引擎程序设计].AI.Game.Engine.Programming.(美)Brian.Schwab.扫描版【有目录+可搜索+可编辑】
本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。
部分目录如下:
第1 部分
第1 章
1.1
1.2
1.3
1.4
概述
1.5
1.6
第2 章
2.1
2.2
基本定义与概念……·…………… ..3
什么是智能................................... 3
什么是游戏AI .... ……………………·3
什么不是游戏Al …·………………… 6
该定义与人工智能理论
定义的区别.... ... . .... . . ... .......... . …... 8
可应用的大脑科学与心理学
理论... ...... .. .. .. .. .. ...... .. ... . .. .. .......... . 9
1.5.1 大脑的组织结构...….... …· …..... 9
1.5.2 知识库与学习....……............... 10
1.5.3 认知.......................................... 12
1.5.4 心智理论............ . ...............…... 13
有限朵优…............................... 19
来自机器人技术的启发..........20
1.5.5
1.5.6
小结... . ....... .. . .. ....... . ....... .. ............ 22
Al 引擎的基本组成与设计... .. .…·23
决策与推理........... ….... ….. …....... 23
2.1.1 解决方案的类型…............…···24
2.1.2 智能体的反应能力…... ....., .. …·24
2.1.3 系统的真实性.... . ..……........ …··24
2.1.4 游戏类型……. .……... , .......... …··25
2.1.5 游戏内容······· ··· ········ · · ·· · · ·· ····· · ··25
2.1.6 游戏平台············· · ······ · ····· · ·······25
2.1.7 开发限制.......…·······················27
2.1.8 娱乐限制······· · ·…............ …······28
输入处理机与感知……………..…·29
2.3
2.4
2.5
第3 章
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
2.2.l
2.2.2
2.2.3
2.2.4
3.5.1
3.5.2
3.5.3
3.5.4
感知类型. . ... 舍............... .... .........29
更新规则.......….... …................. 29
反应时间..…............................. 30
门限.................... ..... ... ........ ...... 30
负荷平衡··· · · · ······· ····…··············30
计算代价与预处理...…· ….... …30
2.2.5
2.2.6
导航..................................... . ..... . . 31
2.3.1 基于网格... 合.................. .. ......... .31
2.3.2 简单避免与位势场…..... .. .……·32
2.3.3 地图节点网络······….... ……·····33
2.3.4 导航网格... .. . ........................... 33
2.3.5 组合系统··· · · · ·· ··· ··· ··……············34
综合考虑····························· ·· ·· ·· ··35
小结················· · ·· · ··· ·· ·· ·· ·········· ·· ·· ·36
Alst~roids: Al 试验平台… ·…... 37
GameObj 类........…······· …........... 38
GameObj 类的Update()函数…··39
Ship 对象.. ............................ ...... 40
其他游戏对象.....…………..... …·… 41
GameSession 类............. ….......... 42
主逻辑与碰撞检测·……...…..... 43
对象清除. ............……............... 45
主飞船和宝物的产生.. .………·-45
奖励生命..........................…..... 46
3.5.5 级别和游戏的结束...………..... 46
Control 类· · ························ ·· ·· ·· ·· · ·47
AI 系统钩子·· · ···· ··……............ …··47
游戏主循环..... ...….... ..... ............. 48
小结............................................. 48
VI
Al 游戏引擎程序设计
第II 部分游戏类型
第4 章角色扮演类游戏.....…………·…·53
4.1 通用AI 元素.......... . ...…... .......... 57
5.4.2 传统冒险根源的回归....... .…···74
5.4.3 更好的NPC 通信….... ..…..... …74
5.4.4 用户界面······ · ··· · · · ··· · ·········· ·鲁···· · 74
5.5 小结········ · ·· · ··· ·· ···· · ·· ·· ··· · ··· · ··· · ··· · ···75
4.1.l 敌人·…· …. .... ….... ....... .. .. ........ 57 第6 章即时策略游戏. .. ... .. .. ........... . ... 77
4.l.2 头目................................... 5g 6.1 通用AI 元素.. . ..... . ..... . ....... .. .. .. .. . 77
4.l.3 非玩家角色...... ....... ....…··········58 6.1.l 个体单元................ . .. ... ............77
4.1.4 店员··········· · ···· · ············ ·· ···· · ······59
4.1.5 队员.............. .. . . .. . . .. ... . ... . . . ........ 59
4.2 有用的AI 技术…..………………... 60
4.2.1 脚本. ................. . ........ . . ...... .... . . . 60
4.2.2 有限状态机……... .. ...…….... …61
4.2.3 消息. .... . .......... . ... . ... . ...... . ....... ... 62
4.3 示例................ . ... .. ............ . .......... 62
4.4 例夕卜········ ·· ················ ·· ·················63
4.5 需要改进的具体游戏元素……· 64
4.5.1 角色扮演不等于战斗...... …·64
4.5.2 语法机器.. . ... . . . ... . . .…···············64
4.5.3 任务发生器........................ . .....65
4.5.4 更好的队员AI·…········· …….. 65
4.5.5 更好的敌人…….. . ... .. ... . . .………·66
4.5.6 完全真实的市镇. . . . . ...….. …...... 67
4.6 小结. . ... . .. . ..... . .............. .. . .. .. .. .. .. .. . 68
第5 章冒险类游戏··· ··· ·· ·· ·· · ················69
5.1 通用Al 元素··· · ················· ·· ··· ·· · · 70
5.1.l 敌人Al····· ····················· · ··········70
5.1.2 非玩家角色…· ·· ·· ·……........ …···70
5.1.3 协作元素···· ···· · · · ············ · · · · ·· · · ···71
5.1.4 感知系统... . .... . ... . ...... . ... . ......... . 71
5.1.5 摄像机······ ········· · · · ····· · · ···· · ·····... 71
5.2 有用的Al 技术……..... .………….. 71
5.2.l 有限状态机....…..... .…·…·……··71
5.2.2 脚本系统..... .... ... ….............. …··72
5.2.3 消息系统·········· ·················· ···· ·· 72
5.2.4 模糊逻辑... . . . ... . ... . ... . ...….......... 72
5.3 示例............................................. 73
5.4 需要改进的领域…………………… ·74
5.4.1 潜行目标的附加类型·· ···· ··· · ····74
6.1.2 雇佣个体单元·…..................... 7g
6.1.3 指挥官与中级战略性元素......7g
6.1.4 高层战略性A1 ….....….. ….... 7g
6.1.5 市镇构建......... …...................... 79
6.1.6 本土生活............ ..…...... ...... …·79
617 路径搜索. . ....…..... … 79
6.1.8 战术与战略支撑系统...………·79
6.2 有用的AI 技术………….. …..... ….. 81
6.2.1 消息............ . . ......... .... . .............. 81
6.2.2 有限状态机.…..….. ……..... …… 81
6.2.3 模糊状态机. . ... . ..... ...…..... ….... g2
6.2.4 层次化AI·· …............... ...... …... g2
6.2.5 规划............ .......... . . . .. . . . ....... .. . .. 82
6.2.6 脚本.......................................... 82
6.2.7 数据驱动Al·……………….... …··83
6.3 示例· · ··············· ·· ··· · ··· ·· · · ·· · ············84
6.4 需要改进的领域……………..... ….. 85
6.4.l 学习.......... .. ..... . . . . . . ................... g5
6.4.2 确定Al 元素何时受困...…..... g5
6.4.3 Al 助手··· ········· ·· ·· ···.............…86
6.4.4 对抗人物............. ….................. 86
6.4.5 多战略少战术.............…….. …87
6.5 小结............... . ... .. . .. ................... .. 88
第7 章第一人称/第三人称射击游戏.. . 89
7.1 通用AI 元素.............. . .. . .…· …..... 91
7.1.1 敌人............. ................... . ......... 91
7.1.2 敌人头目. ......................... ....... .92
7.1.3 死亡竞赛对手…·……….. .……···92
7.1.4 武器············ · ········ · ····.. ··············92
7.1.5 协作智能体........………….. .. …·93
7.1.6 分队成员.................. ....... ... .. . ...93
7.1.7 路径搜索.... . .............................93
7.1.8 空间推理................. ... ...........94
7.2 有用的AI 技术...……... …….. …... 94
7.2.l 有限状态机··········· .. . ........ . ... ....94
7.2.2 模糊状态机.... …....... …•····· …···97
7.2.3 消息系统········ · · · · ··· ············· · · ···· 98
7.2.4 脚本系统.. . ....... . .. ........... . .. ..... . .9g
7.3 示例.. .. ... . .. . ................. . .......... ...... 98
7.4 需要改进的领域…….......……...... 99
7.4.l 学习与对千建模...…....... … ···99
7.4.2 个性· ·· ········· · ··· · ········· · · · ·· · · • ······1 00
7.4.3 创造力········· · ·········· · · · ···· ..·······100
7.4.4 预测......... . ... . .. ....... . . . ... . ........ .. 100
7.4.5 更好的会话引擎....…····· … ··101
7.4.6 动月L··· · · · ······················· • · · ······ · ·1 01
7.4.7 更好的分队Al··· ··· ..· …···········101
7.5 小结................... ...... ........... . ... .. . 101
第8 章平台游戏....... .. ... ........... ... .. ... 103
8.1 通用Al 元素....................... . .. . . 108
8.1.l 敌人..... . .. . .... . .......... ....... . ........ )08
8.1.2 敌人头目....... .. ... . ......... .. .. . ..... 108
8.1.3 协作元素.. .... . ........ . .............. . . 108
8.1.4 摄像机······· · ············· · ············· · 109
8.2 有用的AI 技术.. . ……........ ……·llO
8.2.1 有限状态机.. . .……············· …110
8.2.2 消息系统............... . .. …........... 1 IO
8.2.3 脚本系统.....…….. .……·······110
8.2.4 数据驱动系统……....….......... 110
8.3 示例.... ............ .. .. .. .. ........... ......... 110
8.4 需要改进的领域..……….. ……..... l 11
8.4.1 摄影技巧· · · · · ·· ·· · ············ ·· ········111
8.4.2 帮助系统·· ········--··... ............... 111
8.5 小结................ . ............... . ..... ...... 112
第9 章射击类游戏…… …...…·….... …·113
9.1 通用Al 元素.................. ... . . ...... 118
9.1.1 敌人.............. . ...... ....... ............ 118
9.1.2 敌人头目................................ 118
9.1.3 协作元素.......... . ............…······ 119
目录
9.2 有用的Al 技术..……... ….. ……... 119
9.2.1 有限状态机..…·········· --…… ·· · 119
9.2.2 脚本系统·· · ·············· ············· ··119
9.2.3 数据驱动系统··········'"… ····· · ···l l9
9.3 例外···················· · ·· · ··· · ············ · ··120
9.4 示例········ · ··· ····· ·········· ···· ·· ·· ········ 120
9.5 需要改进的领域…. .………... …... 121
9.6 小结·········..··· ····· ····················· ···l22
第10 章运动类游戏….,..... …………···123
10. l 通用AI 元素.... .…................... 124
10. l.l 教练或团队级别Al·· · · ······124
10.l.2 玩家级别Al····….. ……····· 124
10.l.3 路径搜索.......… •... ………·125
10.l.4 摄像机······ ········· · ············· ·· ·1 25
10.l.5 混杂元素···························· 126
10.2 有用的Al 技术·……...……….... 127
10.2.1 有限状态机与模糊
状态机. ....... . . . . .................... ,27
10.2.2 数据驱动系统..…...... …….. 133
10.2.3 消息系统.. . ........……......... 134
10.3 示例·· ·· ··············· ··· · ·· ················ 1 34
10.4 需要改进的领域…·……·……… ·135
10.4.1 学习......... ............ ............ . .. 135
10.4.2 游戏平衡...…........ ……........ 135
10.4.3 玩法创新.... ......... ..... .. ..... 135
10.5 小结········ ·· ·················"··· ·· ·······136
第11 章赛车游戏..... ... …..... .. …........ 139
11.l 通用Al 元素····· ··· · ···· · ··· ·········· 140
ll.l.l 轨迹Al·· · ·.. ······ …................ 140
11.1.2 交通. ............. . .. ........... ........ 141
11.1.3 行人.. .... .. .. ............... . .......... 142
11. l.4 敌人与战斗·……·……·……... 142
11.1.5 非玩家角色…...........………·142
l l. l.6 其他竞争行为...…... ……..... 142
11.2 有用的Al 技术·……..………….. 143
11.2.1 有限状态机···· ·· ·..…........... 143
11.2.2 脚本系统…………...……….... 143
11.2.3 消息系统....... . .................... 143
VII
软考_嵌入式系统设计师教程2010年版
嵌入式系统是一种应用范围非常广泛的系统。可以说除了桌面计算机和服务器外所有
计算设备都属千嵌入式系统,例如从便携式音乐播放器到航天飞机上的实时系统控制都属
千嵌入式系统。
大多数商用的嵌入式系统都设计成专用任务的低成本的产品。大多数的嵌入式系统都
具有实时性的要求。有些功能需要非常快的主频,但其他大多数功能并不需要高速的处理
能力。这些系统通过特定的器件和软件来满足实时性的要求。
简单地通过速度和成本来定义嵌入式系统是困难的,但对千大批量的产品而言,成本
常常对系统设计起决定作用。通常,一个嵌入式系统的很多部分相对系统主要功能来说需
要较低的性能,因此嵌入式系统和通用PC 相比,能够使用一个满足辅助功能的合适的
CPU, 从而简化了系统设计,降低了成本。例如,数字电视的机顶盒需要处理每秒以百万
兆位计的连续数据,但这些数据处理大部分是由定制的硬件来实现的,如解析、管理和编
解码多个频道的数字影像。
对千大批量生产的嵌入式系统,如便携式音乐播放器或手机等,降低成本就成为最主
要的问题。这些系统通常只具有几个芯片:一个高度集成的CPU, 一个定制的芯片用千控
制其他所有的功能,还有一个存储芯片。在这种设计中,每部分都设计成使用最小的系统
功耗。
对千小批量的嵌入式应用,为了降低开发成本,常常使用PC 体系结构,通过限制程
序的执行时间或用一个实时操作系统来替换原先的操作系统。在这种情况下,可以使用一
个或多个高性能的CPU 来替换特殊用途的硬件。
嵌入式系统的软件通常运行在有限的硬件资源上:没有硬盘、操作系统、键盘或屏幕。
软件一般都没有文件系统,如果有的话,也会采用Flash 驱动器。如果有人机交互接口的
话,也是一个小键盘或液晶显示器。硬件是计算机的物理部分,和存储在硬件中的计算机
www.TopSage.com
www.TopSage.com
2
嵌入式系统设计师教程
软件程序和数据区分开来。
嵌入到机械中的嵌入式系统需要长期无故障连续运行, 因此它的软件需要比PC 中的
软件更加仔细地开发和更加严格地测试。
那么,到底什么是嵌入式系统呢?
根据IEEE (国际电气和电子工程师协会)的定义,嵌入式系统是“控制、监视或者辅
助设备、机器和车间运行的装贺"(原文为devices used to control, monitor, or assist the
operation of equipment, machinery or plants) 。这主要是从应用上加以定义的,从中可以看
出嵌入式系统是软件和硬件的综合体,还可以涵盖机械等附属装置。
目前国内一个普遍被认同的定义是:以应用为中心、以计算机技术为基础,软件
硬件可裁剪,适应应用系统对功能、可靠性、成本、体积、功耗严格要求的专用计算机
系统。
可以这样认为,嵌入式系统是一种专用的计算机系统,作为装置或设备的一部分。通
常,嵌入式系统是一个控制程序存储在ROM 中的嵌入式处理器控制板。事实上,所有带
有数字接口的设备,如手表、微波炉、录像机、汽车等,都使用嵌入式系统,有些嵌入式
系统还包含操作系统,但大多数嵌入式系统都是由单个程序实现整个控制逻辑。
代码之殇【已将页面转化为可搜索图像/文字+有目录】
本版本与网上其他资源不同之处在于,此版本可进行编辑,搜索,已进行内容识别扫描。可全选,可编辑,可剪切文字。
目录如下:
本书赞誉
译者序
序
前言
第1 版前言
第1 章项目管理失当
目录
2001 年6 月1 日”开发时间表、飞猪和其他幻想”
2001 年10 月1 日”竭尽所能,再论开发时间表·
2002 年5 月I A, .• 我们还开心鸣?分诊的乐趣”
2004 年12 月' " 向死亡进车”
2005 年10 月1 日”揭露真相”
2008 年9 月I A, .. 我得估算一下”
2009 年5 月1 日” 一切从产品开始
2009 年9 月I B• .. 按计划行吓
20]0 年5 月I B• .. 敏捷的团队合作“
第2 章过程改进,没有灵丹妙药
2002 年9 月2 日.“ 六西格玛,饶了我吧, ..
2004 年1 0 Jj I 日“精益· 比五仵汛牛肉还好”
2005 年4 月1 日“客户不满'
2006 年3 月1 日敏捷子弹”
2007 年10 月I H, .. 你怎么度肚你自己?”
20 10 年10 月I B• .. 有我呢。”
20 10 年II 月1 日“我在缠珩你吗, ""'报告。”
2010 年12 月1 日:“生产第一.. ................ .
2011 年2 月1 日“ 周期长度一一生产力的老生常谈”
第3 章根除低下的效率......... . ............. . ........
2001 年1 月I "• •· 迟到的规范书生活现实或先天不足”
2002 年6/11 日" 闲置人手”
2004 年6 月1 日“我们开会的时候`
2006 年1 月1 日”停止写规范书. ii!功能小组呆在一起“
14
/8
21
25
28
3/
32
33
39
44
50
54
58
62
65
70
71
73
77
79
汛
2007 年2 月1 日"糟糕的规范书该指责谁?”
2008'F 2 月1 日: “ 路漫漫, 其修远-j) 布式开发”
2008 钉12 月1 日”伪优化”
2009 年4 月1 日世界, 尽在掌握“
2011 年4 月1 日“你必须做个决定
第4 章跨越工种............. .... .....
2002 年4 月1 日.“现代临时夫妇?开发与测试”
2004 年7 月1 日“感觉性急一测试者的角色”
2005 年5 月1 日”模糊逻fl-一君子之心”
2005 年II 月1 日”废除I 种一布什么理由消.七业化?”
2009 <F I 月1 日”持续工程的儿话”
2011 年5 月I R , "测试不该不受>Jlll"
第5 章软件质量不是梦·…... ….......
2002 年3/llli," 你对你的安全放心吗”
2002 年II 月1 日.“牛肉在哪里?为什么我们要质扯"
2004 年4 月1 日“软件发展之路~从手工艺到工程”
2005 年7 月1 日“复市一下这个一市在“
2006 年10 月1 日”对质让的大胆预测..
2008 年5 月1 日``碰撞测试恢复“
2008 钉10 月1 日"盯紧标称“
第6 章有时间就做软件设计
2001 年9 月I A'" 错误处理的灾难”
2002 年2 月1 日勹太多的厨师弄馈了一锅好汤啡一权戍"
2004 年5 月1 日;“通过设计斛决.. ................... ..
2006 年2 月1 日“质址的另一面一设计师和架构帅”
2006 年8 月1 日”央妙隔离一更好的设计”
2007 年II 月IH 软件性能你在等什么?”
2008 年4 月1 日: 伍为您效劳" . ...............
2008 年8/11 日“我的试验成功了! (原型设计)”
2009 年2 月I H, "绿野中长清姐了“
第7 章职业生涯历险记.......
200 1 年12 月1 日”当熟练就是目标”
2002 年10 月lfl," 人生是不公平的一去核曲线”
2006 年II 月I A' .. 职业阶段上的角色”
2007 年5 月1 日”与世界相连`
2007 年II 月1 日”找个好工作一发现新角色”
2007 年12 月1 日“要么带头做事,要么唯命是从,要么赶紧离开“
2008'" 7 月I H , .. 猩猩在装中的机遇”
20I O 年3 月I H, "我是很负责的"
2010 年4 月I " ' .. 新来的伙计”
82
85
89
91
94
98
99
IOI
/05
109
Ill
114
JIB
119
121
127
/31
/36
/38
142
146
147
149
151
155
158
161
164
167
170
174
175
177
180
/83
187
190
194
196
200
Xv
2010 年6 月I H'•• 升级”
2010 年9 月[日:"肝煌时代”
2011 年1 月I H," 个休倾导右"
第8 章自我完善..................
2002 年12 月1 日“合作还姑分过扬镶一协商”
2005 年2 月1 日.“从好学会平衡生活”
2005 年6 月1 日'. 有的是时间"
2005 年8 月1 日"寓利于乐,控利你的上词“
2006 年4 月1 日“你在限我讲吗,沟通的从础”
2007 年3 月1 日”不怂公开与诚实肌么简小
2009 年3 月1 日:“我听轩呢"
2009 年7 月I H," 幻灯片”
2009 年12}1 1 日.不耍悲观”
2010 年SJI I H, .. 我捅娄子了“
2011 年3 月I H, "你也不赖"
第9 章成为管理者,而不是邪恶的化身
2003 年2 月1 日.不仅仅是数字一生产力”
200! 年9 月I H , "面试流程之外”
2004 年II 月1 日“最难做的飞作一绩效不仕者”
2005 年9 月1 日.随波还流一人才的保持和流动"
2005 年12 月I H, • 管理我在行“
2006 年5 月1 日“比较的恶果店态团队
2邸年3 JI I H, .. 必须改变掌控改变”
2009 年6 月I H, •• 奖赏.很难”
2009 年10 月I 8," 招人总怂后悔"
2009 年II 月1 日.。竹理饱了....
20!0 年1 月1 日” 一对一与多对多”
2010 年7 月1 日“文化冲击“
第10 章微软, 你会喜欢它的
200 1 年II 月1 日.我怂怎样懂得不再焦虑并爱上重组的"
2005 年3 月1 日.你的产品小元经理是个浒民吗,.
2006 年9 月I H, .• 有幸成为W叩ow, 的主书者”
2006 年12 月I B • "Googl,, 严项的威胁还是糟糕的拼写,··
2007 年4 月I A, "中年危机. ................... .
2008 年II 月1 日.虚无主义及其他的创新毒药"
2010 年2 月'" 畛我们丛功能型的吗?”
术语表
203
207
210
213
2/4
216
219
224
228
23/
234
236
240
243
245
248
249
251
255
258
262
266
269
272
275
278
280
284
2,.8,7,
290
293
2911
JOI
305
]OIi
312
Java游戏高级编程.pdf
内容简介
在第1 章“配置开发环境”中,我向读者介绍了将要在整本书中使用的代码库。描述了这
个库的设计, 并给出了编译示例游戏的说明。可能会在游戏开发环境中使用的一些附加代码、
图形和音频文件,也在本章确定了下来,还介绍了软件开发的一些流行工具。以模板的形式给
出了一个演示Java 游戏编程基础知识的游戏示例。
在第2 章“部署框架”中,我们关注的重点是在可以安装在多种不同类型的平台上的一个
框架中部署游戏。在动画线程管理技术的相关内容中,介绍了一个被广泛使用的框架接口以及
applet 生命周期。在对适合千游戏的不同发布而进行不同部署的选项进行了一个简要的回顾以
后,给出了允许游戏部署在不同开发环境中而不需要任何修改的一个抽象层的源代码示例。
在第3 章"Swing 动画”中,介绍了一个基于Swing 的动画库,这个动画库会在整本书中
使用。这一章主要考虑的问题是动画的性能和灵活性。在介绍核心动画引擎类的源代码时简单
介绍了优化权衡。
在第4 章“动画库”中, 介绍了通用动画任务的一个类集合。这些类提供了很多功能,例
如场景管理和Sprite 实现。它们也用来介绍怎样开发与核心动画引擎类互操作的游戏特定代码。
在第5 章“高级图形技术”中,介绍了高级图形技术,包括硬件加速图形、多缓冲和全屏
独占模式。给出了使这些技术的使用变得更加方便的可重用类和使用这些可重用类的示例游
戏。对其中的每—个技术,都介绍了关千它们使用方法的一些限制。
在第6 章“持久数据“中,对在各种部署框架中加载和保存游戏数据的机制进行了对比。
在这个过程中还介绍了可以用千大多数游戏编程的可重用数据待久性的类库。对更加高级的持
久性需求的其他选择也进行了考虑。
在第7 章“游戏体系结构”中, 介绍了适合千Java 游戏开发的面向对象的软件体系结构
的优点。使用这种体系结构的一个示例游戏是作为新游戏开发模板进行介绍的。本章还简单介
绍了一下数据驱动的设计。
在第8 章"A * 算法”中,介绍了现在在游戏行业中虽流行和最常用的一个人工智能(Al)
算法的实现。本章还介绍了使用A*算法绕过蹄碍物寻找路径的示例。
在第9 章" HTTP 隧道技术”中,介绍一个可以在大部分Java 游戏部署环境里常见的安全
限制以内进行操作的一个联网库。本章还给出了一个示例,在这个示例中,数据在服务器和客
户机之间进行传递。
在第10 章" HTTP 轮询机制”中,将联网库扩展以支持在线多玩家游戏。使用轮询来同步
客户机和服务器上的游戏状态。在由单玩家游戏向多玩家联网游戏的转换中,介绍了我所推荐
的软件体系结构的灵活性。
在第I I 章" HTTP Pulling 机制”中,事件驱动的消息是作为轮询的另一个选择而推荐使
用的。使用在前面两章中介绍的这些类,演示了这是怎样在无符号applet 的安全限制以内实现
的。使用这些技术进行进一步开发的一些建议已经超出了本书的范围,这里只进行简单的介绍。
深入JAVA虚拟机
译老序
前言
第1 章Java体系结构介绍................. ….... J
I.I 为什么使用Java ................................. J
1.2 网络带来的挑战和机遇·……....... …....... J
1.3 体系结构. ...... ... ..... .... ..... .... ..............2
1.3.1 Java 虚拟机.................................2
1.3.2 类装载器的体系结构..…….... ………4
I .3 .3 Java class 文件..............................7
1.3.4 JavaAPI .................................... 7
1.3.5 Java程序设计语言....... .. .............. .8
1.4 Java体系结构的代价.............….. …... JO
1.5 结论.......................... . ..................13
1.6 资源页...................... ... ................ .13
第2 章平台无关............... ... .. .... .. .. .. ......15
2.1 为什么要平台无关.... .. .....................15
2.2 Java的体系结构对平台无关的支持......16
2.2.1 Java 平台................................. 16
2.2.2 Java 语言................................. 16
2 .3 .3 Java cl ass 文件........................... 16
2.2.4 可伸缩性.. ................ .. ......... . . .....16
2 .3 影响平台无关性的因素......……………18
2.3.1 Java平台的部署...........................18
2.3.2 Java平台的版本...........................18
2.3.3 本地方法...... . .. . .. .. ............ . .........19
2.3.4 非标准运行时库........... .... ............20
235 对虚拟机的依赖… · … .. .... ............ 20
2.3 .6 对用户界面的依赖............ . .....…... 21
2.3.7 Java平台实现中的bug .... .............. z1
2.3.8 测试.......... .. ........... . ... . . . . .. ........ .2/
2 .4 平台无关的七个步骤………·…..... …... 2,
2.5 平台无关性的策略.... ..……...... …..... ,22
2.6 平台无关性和网络移动对象..………....24
2.7 资源页..........................................24
第3 章安全........ .. .. . ... .... ..... ....... .. .. .. ... .25
3.1 为什么需要安全性…....... ….............. z5
3.2 基本沙箱........................ .. ..... ...... ..z6
3.3 类装载器体系结构…...... …............... z7
3.4 class文件检验器..............................31
3.4.l 第一趟: class 文件的结构检查……...3z
3.4.2 第二趟:类型数据的语义检查....…··33
3.4 .3 第三趟:字节码验证·…·… .. ......….. 33
3.4 .4 第四趟:符号引用的验证·….... .…·· ·34
3.4.5 二进制兼容......................... .. . .... .35
3.5 Java虔拟机中内置的安全特性. ………..36
3.6 安全管理器和Java AP! · …………........ 38
3.7 代码签名和认证............ .... ..............41
3.8 一个代码签名示例............ .... ... ..... ...45
3.9 策略..... . ................ .. ... .. .. .... .. ....... .49
3.10 保护域.. . ........ . ....... .. .. ... ...... . .........52
3.1 1 访问控制器........... ..... ................ ....54
3.11.1 implies ()方法··· ····· ·· ············ · ·54
3.11.2 栈检查示例........................ .. ....56
3.11.3 一个回答”是"的栈检查... .…·…·59
3 . 11.4 一个回答“不"的栈检查. ...…….. 62
3. II .5 do Privileged ( )方法.. .. ........ . .....64
3.11.6 doPrivileged ( )的一个无效使用...68
3.12 Java安全模型的不足和今后的发展
方向..... . ..... ......... . ........ ... ......... ... .71
3 . 13 和体系结构无关的安全性… ..……·……71
3.14 资源页........ .. .............. . .................72
第4 章网络移动性.................. . ..............73