Chapter 1. A Hypothetical Compiler
P7. "Enable all optional compiler warnings."
P8. "Use lint to catch bugs that your compiler may miss."
P9. "If you have unit tests, use them."
Chapter 2. Assert Yourself
P15. "Maintain both ship and debug versions of your program."
P19. "Use assertions to validate function arguments."
P21. "Strip undefined behavior from your code, or use assertions to catch illegal uses of undefined behavior."
P22. assert is "Not for Errors".
P23. "Don't waste people's time. Document unclear assertions."
P23. "ARE YOU MAKING ASSUMPTIONS AGAIN?“,逐步写出一个鲁棒性好的memset。
P27. "Either remove implicit assumptions, or assert that they are valid."
P27. "Owning the Compiler Is Not Enough",默认int是4字节而不用sizeof,曾经习以为常的居然这么危险!
P29. "Use assertions to detect impossible conditions."
P33. "Don't hide bugs when you program defensively."(defensive programming是指写的函数可以容忍传入的参数有误)
P38. "Use a second algorithm to validate your results."
P38. "Hey, What Goes On Here?"-->自定义宏时最好别调用函数
P42. "Don't wait for bugs to happen; use startup checks."(例如可以在接受数据结束后立即检查数据正确性)
P43. 题2有些意思。题3:注意assert是在debug用的。
Chapter 3. Fortify Your Subsystem
P49. Mac系统,malloc分配的空间可用0xA3填充。因为0xA3A3指令将导致系统crash。该页下面的代码值得一看。
P50. "Eliminate random