Advocating a style of C programming based upon data abstraction (classes) and run-time object verification, Writing Bug-Free C Code describes a technique that results in virtually bug-free code from the beginning. It details the key to writing bug-free code; the class methodology; designing modules; general tips; and a style guide. It is designed for C programmers interested in writing bug-free code.
The class methodology helps to prevent bugs by making it easier to write C code. It does this by eliminating data structures (class declarations) from include files, which makes a project easier to understand (because there is not as much global information), which makes it easier to write C code, which helps to eliminate bugs. This class methodology, which uses private class declarations, is different from C++, which uses public class declarations.
The class methodology helps detect bugs by providing for both compile- time and run-time type checking of pointers (handles) to class objects. This run-time type checking catches a lot of bugs for you since invalid object handles (the cause of a lot of bugs) are automatically detected and reported.
In the end, this book is all about the techniques used to write virtually bug-free code.
1. Understand Why Bugs Exist
2. Know Your Environment
3. Rock-Solid Base
4. The Class Methodology
5. A New Heap Manager
6. Designing Modules
7. General Tips
8. Style Guide
A. Appendix: Code Listings
Note to this online book: On April 29, 2002, I reacquired the publishing rights to my book (from Prentice Hall), and have decided to publish it online, where it is now freely available for anyone to read (and print – provided that the printed copy is only for your personal use