
C 陷阱与缺陷
C Traps and Pitfalls
Andrew Koenig · 初版 1989 年
19人推荐
24位读者提及
37次提及
为什么值得读
- 帮助读者学会像真正的 C 程序员一样思考
- 深入剖析语言细节,照亮诸多阴暗角落
- 由同名经典论文扩写而成,极具实用价值
即便经验丰富的 C 程序员,如果对自己的操作不够确信,也会陷入麻烦。本书中的众多示例每一个都曾让专业程序员栽过跟头。C Traps and Pitfalls 旨在通过展示他人(甚至是有经验的专业人士)是如何陷入困境的,来倡导 defensive programming。这些错误一旦被识别和理解通常很容易避免,因此本书重点在于具体示例而非泛泛之谈。涵盖 lexical、syntactic 和 semantic 陷阱,linking 和 library 问题,preprocessor 以及 portability 陷阱。
Hacker News 上怎么说
正在加载完整评论……
……有点过时了。正如上层评论所说,只有了解了机器体系结构和 Unix,你才会真正领会 C 语言的精妙。深入大型代码库能让你熟悉“现代” C。我觉得《C 陷阱与缺陷》(C Traps and Pitfalls)是一本能让你像 C 程序员一样思考的书。《C 语言解惑》(The C Puzzle Book)很适合用来做练习,而《C 专家编程》(Expert C Programming)则很好地揭示了 C 丑陋的一面。
…a bit dated. As the parent said, you'll appreciate C only if you learn about machine architecture and Unix. Diving into a large codebase will get you acquainted with "modern" C. I've found the book C Traps and Pitfalls to be the book to get you to think like a C programmer. The C Puzzle Book is pretty good for exercises, and Expert C Programming does a good job exposing the ugly side of C.
……从那往上的所有东西似乎全靠自学,要么来自互联网、代码示例,要么是从第一性原理推导出来的。C 语言里的坑比更新的语言要多得多。Koenig 的书《C 陷阱与缺陷》(C Traps And Pitfalls)https://www.amazon.co.uk/C-Traps-Pitfalls-Andrew-Koenig/dp/0... 在我学这门语言时超级有用(我们当地图书馆就能借到!)。我不知道有没有更新的版本……
…Everything from there up seems to be self-taught, either from the internet, code examples, or working it out from first principles. There are a lot more risks in C than more recent languages. Koenig's book "C Traps And Pitfalls" https://www.amazon.co.uk/C-Traps-Pitfalls-Andrew-Koenig/dp/0... was extremely useful to me when I was learning the language (available at my local library!). I don't know if there's a more modern version…
……很干净,像 C 一样),不过 Python 以及编译成 C 的 Lisp/Scheme 也很管用。(这里我没法评价 Ruby,因为我已经会 Python 和 Lua 了,就没去折腾它。)另请参阅:Andrew Koenig 的《C 陷阱与缺陷》(http://www.literateprogramming.com/ctraps.pdf)以及在此论文基础上扩展而成的专著。
…clean, like C), though Python and Lisps/Schemes that compile to C work well too. (I can't vouch for Ruby here, since I already know Python and Lua and haven't bothered with it.) See also: Andrew Koenig's "C Traps and Pitfalls" (http://www.literateprogramming.com/ctraps.pdf) and the book, which expands on the paper.
想要更多类似的内容,可以看 Koenig 的《C 陷阱与缺陷》(C Traps and Pitfalls)。见鬼,那篇演变成这本书的原文(http://www.literateprogramming.com/ctraps.pdf)甚至在网上能免费看。另外,对于任何从事现代 C 开发的人,我强烈推荐 Hanson 的《C 语言接口与实现》(C Interfaces…
For far more of same, there's Koenig's _C Traps and Pitfalls_. Heck, the article (http://www.literateprogramming.com/ctraps.pdf) that grew into the book is even free online. Also, for anybody doing modern C work, I strongly recommend both Hanson's _C Interfaces…
……编程。也许其他人有比这更好的推荐……?除此之外,当你在学习真正彻底搞懂指针、数组等知识时,《C 语言解惑》(The C Puzzle Book)绝了。Koenig 的《C 陷阱与缺陷》(C Traps and Pitfalls)对于了解一些隐秘角落也相当不错。
…programming. Maybe other people have better recommendations than that..? Separate to that "The C Puzzle Book" is superb when you're learning to really thoroughly understand pointers, arrays and so on. Koenig's "C Traps and Pitfalls" isn't bad for some of the dark corners.
……来自 H&S。在这个书单里(说不准它们现在有多适用了),http://www.c-faq.com/resources/sd19.html 我喜欢的有:- K&R 和 H&S(如果非选不可,选 H&S)- P.J.Plauger 的《标准 C 语言库》(The Standard C Library)- Andrew Koenig 的《C 陷阱与缺陷》(C Traps and Pitfalls)。
…from H&S. From this list (can't say how current they are), http://www.c-faq.com/resources/sd19.html I liked: - K&R and H&S (if you have to choose, H&S) - The Standard C Library, P.J.Plauger. - C Traps and Pitfalls, Andrew Koenig.