图灵程序设计丛书

编程精粹:编写高质量C语言代码(英文版)

Steve Maguire (作者)
终止销售
与《代码大全》齐名的微软不朽技术名著!

软件日趋复杂,编码错误随之而来。怎样编写优秀无错的C语言代码?本书将揭示大量不传之秘。书中给出了多条编程方面的指导,这些指导看似简单,却是作者多年思考及实践的结果,是对其编程经验的总结。书中解决问题的思考过程对于程序开发人员尤显珍贵。

输入优惠码:新春特急

电子书每单满200减80,可以用到除夕夜哦,祝大家happy hacking 一整年!

纸书停发:2月3日~26日

纸质书
¥45.00

其他购买方式?

出版信息

  • 书  名编程精粹:编写高质量C语言代码(英文版)
  • 系列书名图灵程序设计丛书
  • 执行编辑关于本书的内容有任何问题,请联系 傅志红
  • 出版日期2008-12-29
  • 书  号978-7-115-19316-2
  • 定  价45.00 元
  • 页  数284
  • 开  本16开
  • 出版状态终止销售
  • 原书名Writing Solid Code
  • 原书号978-1-55615-551-2

同系列书

  • HTTP权威指南

    David Gourley   Brian Totty   Marjorie Sayer   Sailu Reddy   Anshu Aggarwal   陈涓   赵振平   译

    本书是HTTP及其相关核心Web技术方面的权威著作,主要介绍了Web应用程序是如何工作的,核心的因特网协议如何...

  • JavaScript高级程序设计(第3版)

    Nicholas C.Zakas   李松峰   曹力   译

    本书是JavaScript超级畅销书的新版。ECMAScript 5 和HTML5在标准之争中双双胜出,使大量...

  • 计算机科学的基础

    Al Aho   Jeff Ullman   傅尔也   译

    本书全面而详细地阐述了计算机科学的理论基础,从抽象概念的机械化到各种数据模型的建立,用算法、数据抽象等核心思想...

  • Java技术手册(第6版)

    Benjamin J Evans   David Flanagan   安道   译

    通过学习本书,你将能够: 掌握最新的语言细节,包括Java 8的变化 使用基本的Java句法学习面向对...

  • 机器学习实战

    Peter Harrington   李锐   李鹏   曲亚东   王斌   译

    机器学习是人工智能研究领域中一个极其重要的研究方向,在现今的大数据时代背景下,捕获数据并从中萃取有价值的信息或...

本书特色

与《代码大全》齐名的经典著作
揭示微软成功的技术奥秘
C语言高手的秘籍

目录

OREWORD by Dave Moore, Director of Development, Microsoft xi
PREFACE xvii
INTRODUCTION xxi
With the growing complexity of software and the associated climb in bug rates, it's becoming increasingly necessary for programmers to produce bug-free code much earlier in the development cycle, before the code is first sent to Testing. The key to writing bug-free code is to become more aware of how bugs come about. Programmers can cultivate this awareness by asking themselves two simple questions about every bug they encounter: "How could I have prevented this bug?" and "How could I have automatically detected this bug?" The guidelines in this book are the results of regularly asking these two questions over a number of years.
1 A HYPOTHETICAL COMPILER 1
If your compiler could detect every bug in your program~no matter the type--and issue an error message, ridding your code of bugs would be simple. Such omniscient compilers don't exist, but by enabling optional compiler warnings, using syntax and portability checkers, and using automated unit tests, you can increase the number of bugs that are detected for you automatically.
2 ASSERT YOURSELF 13
A good development strategy is to maintain two versions of your program: one that you ship and one that you use to debug the code. By using debugging assertion statements, you can detect bugs caused by bad function arguments, accidental use of undefined behavior, mistaken assumptions made by other programmers, and impossible conditions that nevertheless some how show up. Debug-only backup algorithms help verify function results and the algorithms used in functions.
3 FORTIFY YOUR SUBSYSTEMS 45
Assertions wait quietly until bugs show up. Even more powerful are sub system integrity checks that actively validate subsystems and alert you to bugs before the bugs affect the program. The integrity checks for the standard C memory manager can detect dangling pointers, lost memory blocks, and illegal use of memory that has not been initialized or that has already been released. Integrity checks can also be used to eliminate rare behavior, which is responsible for untested scenarios, and to force subsystem bugs to be reproducible so that they can be tracked down and fixed.
4 STEP THROUGH YOUR CODE 75
The best way to find bugs is to step through all new code in a debugger. By stepping through each instruction with your focus on the data flow, you can quickly detect problems in your expressions and algorithms. Keeping the focus on the data, not the instructions, gives you a second, very different, view of the code. Stepping through code takes time, but not nearly as much as most programmers would expect it to.
5 CANDY-MACHINE INTERFACES 87
It's not enough that your functions be bug-free; functions must be easy to use without introducing unexpected bugs. If bug rates are to be reduced, each function needs to have one well-defined purpose, to have explicit single-purpose inputs and outputs, to be readable at the point where it is called, and ideally to never return an error condition. Functions with these attributes are easy to validate using assertions and debug code, and they minimize the amount of error handling code that must be written.
6 RISKY BUSINESS 111
Given the numerous implementation possibilities for a given function, it should come as no surprise that some implementations will be more errorprone than others. The key to writing robust functions is to exchange risky algorithms and language idioms for alternatives that have proven to be comparably efficient yet much safer. At one extreme this can mean using unambiguous data types; at the other it can mean tossing out an entire design simply because it would be difficult, or impossible, to test.
7 TREACHERIES OF THE TRADE 145
Some programming practices are so risky they should never be used. Most such practices are obviously risky, but some seem quite safe, even desirable, because they fill a need without apparent hazard. These treacherous coding practices are the wolves m sheep's clothing. Why shouldn't you reference memory you've just released? Why is it risky to pass data in global or static storage? Why should you avoid parasitic functions? Why it is unwise to rely on every nit-picky detail outlined in the ANSI standard?
8 THE REST IS ATTITUDE 171
A programmer can follow every guideline in this book, but without the proper attitude and a set of good programming habits, writing bug-free code will be much harder than it needs to be. If a programmer believes that a bug can simply "go away," or that fixing bugs "later" won't be harmful to the product, bugs will persist. If a programmer regularly "cleans up" code, allows unnecessary flexibility in functions, welcomes every "free" feature that pops out of a design, or simply "tries" haphazard solutions to problems hoping to hit upon something that works, writing bug-free code will be an uphill battle. Having a good set of habits and attitudes is possibly the most important requirement for consistently writing bug-free code.
EPILOGUE WHERE DO YOU GO FROM HERE? 195
APPENDIX A CODING CHECKLISTS 197
APPENDIX B MEMORY LOGGING ROUTINES 203
APPENDIX C ANSWERS 213
REFERENCES 245
INDEX. 247
  • 说是英文版,为什么语种却是简体中文?
    lemd  发表于 2009-02-13 09:32:07
合作: 赌博公司网站 真钱娱乐 新葡京娱乐场