\n end will print cute brackets before and after anything you print. The most exciting hook is hook-stop. If the variable suspect is giving you problems, then ask to see it every time the program stops: define hook-stop p suspect end When you are done with your suspect, redefine hook-stop to be nothing: define hook-stop end Using a debugger | 51 Use Valgrind to check for errors Most of our time spent debugging is spent finding the first point in the program where something looks wrong.

Because C gives you the freedom to do idiotic things with memory, debugging means both the quotidian problem of checking our logic (with gdb) and the more technical problem of checking for memory misallocations and leaks (with Valgrind). On the documentation side, this chapter will cover one tool at the interface level (Doxygen) and another that helps you document and develop every step of the program (CWEB). The chapter will also give a quick introduction to the test harness, which will allow you to write lots of tests for your code quickly.

Download PDF sample

Rated 4.63 of 5 – based on 47 votes