Safe C++: How to avoid common mistakes (Paperback)

Vladimir Kushnir

  • 出版商: O'Reilly
  • 出版日期: 2012-07-10
  • 定價: $875
  • 售價: 8.0$700
  • 語言: 英文
  • 頁數: 142
  • 裝訂: Paperback
  • ISBN: 1449320937
  • ISBN-13: 9781449320935
  • 相關分類: C++ 程式語言
  • 立即出貨



It’s easy to make lots of programming mistakes in C++—in fact, any program over a few hundred lines is likely to contain bugs. With this book, you’ll learn about many common coding errors that C++ programmers produce, along with rules and strategies you can use to avoid them.

Author Vladimir Kushnir shows you how to use his Safe C++ library, based in part on programming practices developed by the C++ community. You’ll not only find recipes for identifying errors during your program’s compilation, runtime, and testing phases, you’ll learn a comprehensive approach for making your C++ code safe and bug-free.

  • Get recipes for handling ten different error types, including memory leaks and uninitialized variables
  • Discover problems C++ inherited from C, like pointer arithmetic
  • Insert temporary and permanent sanity checks to catch errors at runtime
  • Apply bug prevention techniques, such as using separate classes for each data type
  • Pursue a testing strategy to hunt and fix one bug at a time—before your code goes into production


在C++中,犯下許多編程錯誤是很容易的 - 實際上,任何超過幾百行的程式很可能都包含錯誤。這本書將教你許多C++程式設計師常犯的錯誤,以及你可以使用的規則和策略來避免這些錯誤。

作者Vladimir Kushnir向你展示如何使用他的Safe C++程式庫,該程式庫部分基於C++社群開發的程式設計實踐。你不僅會找到在程式編譯、執行和測試階段中識別錯誤的方法,還會學習一種全面的方法來使你的C++程式碼安全且無錯誤。

本書提供處理十種不同錯誤類型的方法,包括記憶體洩漏和未初始化變數。你還會發現C++從C語言繼承的問題,例如指標算術。你可以插入臨時和永久的健全檢查,以在執行時捕捉錯誤。應用防錯技術,例如為每種資料類型使用獨立的類別。追求一種測試策略,逐個尋找並修復錯誤 - 在你的程式碼投入生產之前。