在好例子网,分享、交流、成长!
您当前所在位置:首页C/C++ 开发实例常规C/C++编程 → C traps and pitfalls by Andrew Koenig

C traps and pitfalls by Andrew Koenig

常规C/C++编程

下载此实例
  • 开发语言:C/C++
  • 实例大小:5.38M
  • 下载次数:6
  • 浏览次数:38
  • 发布时间:2022-02-06
  • 实例类别:常规C/C++编程
  • 发 布 人:happywuya
  • 文件格式:.pdf
  • 所需积分:3
 相关标签: and APS AP ps

实例介绍

【实例简介】C  traps and pitfalls by Andrew Koenig

【实例截图】

【核心代码】

CONTENTS
o In trod ueti 0 n ;.1
1 Lexi eal pi tf aIls .............................................................•..................................... 5
1.1 = is not == 6
1.2 & and : are not && or : : 7
1.3 Greedy lexical analysis 7
1.4 Integer constants 9
1.5 Strings and characters l0
2 SYnta et ie pi tf alls 13
2.1 Understanding function declarations 13
2.2 Operators don't always have the precedence you want.. 17
2.3 Watch those semicolons! 20
2.4 The switch statement 22
2.5 Calling functions : 24
2.6 The dangling else problem 24
3 Se man tic pi tf aIls , 27
3.1 Pointers and arrays 27
3.2 Pointers are not arrays 32
3.3 Array declarations as parameters 33
3.4 Eschew synecdoche 34
3.5 Null pointers are not null strings 35
3.6 Counting and asymmetric bounds 36
3.7 Order of evaluation 46
3.8 The &&, l :, and ! operators ..48
3.9 Integer overflow : 49
3.10 Returning a value from main : 50
ix
x C TRAPS AND PITFALLS
CONTENTS
4 Linkage .....................•............................................................... ; 53
4;1 What is a linker? ; 53
4.2 Declarations vs. definitions; 54
4.3 Name conflicts and the static modifier 56
4.4 Arguments, parameters, and return values .57
4.5 Checking external types 63
4.6 Header files : 66
5 Library fun eli 0 ns ; ; 69
5.1 getchar returns an integer 70
5.2 Updating a sequential file : 70
5.3 Buffered output and memory allocation 72
5.4 Using errno for error detection ; 73
5.5 The signal function 74
6 Th e prep rocesso r 77
6.1 Spaces matter in macro definitions ; .77
6.2 Macros are not functions 78
6.3 Macros are not statements 82
6.4 Macros are not type definitions 83
7 Porta biIity pi tfalls 85
7;1 Coping with change ; ; 85
7.2 What's in a name? 87
7.3 How big is an integer? 88
7.4 Are characters signed or unsigned? ; 89
7.5 Shift operators , 90
7.6 Memory location zero 91
7.7 How does division truncate? 92
7.8 How big is a random number? 93
7.9 Case conversion ; 93
7.10 Free first, then reallocate? ; 95
7.11 An example of portability problems ; ; 96
8 Advice and answers 101
8.1 Advice ; 102
8.2 Answers 105
CONTENTS
C TRAPS AND PITFALLS xi
Appendix: printf, varargs, and stdarg 121
A.1 The pr in tf fami!y 121
Simple format types : 123
Modifiers 127
Flags 130
Variable field width and precision 132
Neologisms :.•........................................................... -.133
Anachronisms 133
A.2 Variable argument lists with varargs.h 134
Implementing varargs .h ; 138
A.3 stdarg. h: the ANSI varargs .h 139

标签: and APS AP ps

实例下载地址

C traps and pitfalls by Andrew Koenig

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警