1. 返回指向函数的指针这样的函数怎么定义
2. 牢记运算符优先级别
(),[],.,->优先级别高> 单目运算符 > 双目运算符号(算术运算 > 移位运算 > 关系运算 > 逻辑运算 > 三目运算 > 赋值运算 > 逗号运算)
3. C语言允许初始化列表中出现多余的逗号。
int days[] = { 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31, };
注解:这样设计的目的是方便代码美化工具的方便,如果换一种方式书写就更容易理解了。
int days[] = {
31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31,
};
4. 分隔函数参数的逗号并非逗号运算符。例如f(x,y)则x与y的求值顺序是未定的,但是f((x,y))的顺序是确定的,并且该函数只有一个参数。
5. 一个宏如果不带参数,则只需要使用宏名即可,括号无关紧要
6. assert的定义到底是怎样的,使用中不加分号????
assert定义中并没有加分号。
7. putc的c函数实现
8. 可移植性问题可以参考的书目有:《How to Write Portable Software in C(Prentice-Hall)》
9. 自定义的EOF=-1为什么会在 while((c=getchar())!= EOF){}中比系统的慢(前提是去掉 #include <stdio.h>)???
因为stdio.h中的getchar()是宏实现的,所以在去掉stdio.h后,c编译器将其认为是函数,函数的调用开销当然比宏定义的开销要大。
10. 一个常见的错误:如果c是一个字符变量,使用(unsigned ) c 就可得到与c等价的无符号整数。但这是会失败的,因为在将字符c转换为无符号整数时,c将首先被转换为int型整数,而此时可能得到非预期的结果。
正确的方式是使用语句(unsigned char ) c, 因为一个unsigned char类型的字符在转换为无符号整数时无需首先转换为int型整数,而是直接进行
转换。
11. 《C++沉思录》数目,先列在这里了,以后有空看。
12. 不对称边界问题,例如对于有符号数,一般是表示的负数范围比表示的整数范围大1, 鉴于这种结果在处理类似于将负数取反转换成整数时,然后利用相同的代码段对数字进行处理时很有可能因为这个不对称边界而出错,潜在的bug。如果测试人员很有经验可以测试出来,否则,就是未来的一个隐患。
分享到:
相关推荐
自己写的一个介绍《C traps and pitfalls 》的ppt
produce robust and safe systems automatically (and quickly). Once one has got over the learning curve of doing things rigorously, ones mind is free design with flair. Most of the worlds great ...
三合一 > > The_C_Programming_Language.pdf > C Traps and Pitfalls.pdf > Expert C Programming.pdf > 全部英文清晰版。 学习C语言只需要这三本书。
c_traps_and_pitfalls
Java™ Puzzlers: Traps, Pitfalls, and Corner Cases.chm,英文版本,chm 格式,大小 1 Mb,作者:Joshua Bloch、Neal Gafter。 内容预览: Chapter 1. Introduction Chapter 2. Expressive Puzzlers Puzzle 1: ...
结合c/c++开发经历,以及《THE C PROGRAMMING LANGUAGE》和 《C Traps and Pitfails》的阅读笔记。
Traps and Pitfalls of Topic-Biased PageRankPaolo Boldi∗ Roberto Posenato† Massimo Santini Sebastiano Vigna Dipartimento di Scienze dell’Informazione, Università degli Studi di Milano, Italyand† ...
Java™ Puzzlers features 95 diabolical puzzles that educate and entertain. Anyone with a working knowledge of Java will understand the puzzles, but even the most seasoned veteran will find them ...
适合C语言学习的经典资料,1. The C programming language2. Pointers on C3. C traps and pitfalls等
需求分析时需要注意的陷阱,By Karl.E.Wiegers
C 语言深度解剖,一本解开程序员面试笔试的...Koening《C Traps and Pitfalls》; Steve Maguire 的《Write Clean Code》; Steve McConnell 的 《Code Complete. Second Edition》;林锐的《高质量 C++/C 编程指南》。
面试常见陷阱 55 interview traps 55个面试陷阱
traps and pitfalls; the exact signature and definition of the most important classes and functions; and numerous examples of working code. The book focuses in particular on the Standard Template ...
不是很常见,但内容很不错几本不错的C编程书籍,PDF格式。 c traps and pitfalls.pdf C高级编程技术.pdf 微软C编程精粹.pdf ...
05.C++初学者的50个忠告-资料整理 [Effective C++ More
Have you ever noticed that there are plenty of C books with suggestive names like C Traps and Pitfalls, or The C Puzzle Book, or Obfuscated C and Other Mysteries, but other programming languages don't...
Koening《C Traps and Pitfalls》; Steve Maguire 的《Write Clean Code》;Steve McConnell 的 《Code Complete. Second Edition》;林锐的《高质量 C++/C 编程指南》。这些书都是经典之 作,但却都有着各自的缺陷...
《C Traps and Pitfalls》经典书籍,学会避开常见陷阱 《C语言高级程序员编程指南》 详细描述,众多实例 《嵌入式系统高级C语言编程》底层的苛刻条件更能训练能力 《VC++之MFC类库中文手册》MFC图形化编程
华为内部学习材料-面试命题参考书目.rar 内包含编写无错c程序秘诀、c traps and pitfalls、c语言常见问题集等。。。
The solutions go well beyond a simple explanation of the program's behavior--they show you how to avoid the underlying traps and pitfalls for good. A handy catalog of traps and pitfalls at the back ...