C Language

The Right Tool For the Job

A variety of other tools in addition to good editors can make a big difference in C and C++ programming. Some of these tools help with "programming in the small" (working on a single program); others help with "programming in the large" (working on systems that comprise many programs).

One set of tools documents or analyzes C or C++ source code. A variety of "pretty printers" can format code and produce cross-reference listings of variables, functions, and classes; flowcharts; and module structure charts. These are especially useful tools for dealing with legacy code that may be poorly laid out and documented. Unfortunately, most formatters do not provide much flexibility in specifying the output's layout. For new code, you're better off using a good editor that lets you apply human judgment as you work with the code, so you get easy-to-read displays and listings without needing a separate formatting tool.

Code analyzers range from fairly simple "lint" utilities to tools that check code compliance against standards and calculate various measures of code "complexity." Lint utilities examine C source for constructs that may be acceptable to the compiler but that are likely to be unintentional and incorrect. For example, most lint utilities will report the use of = within conditional expressions.

As an example of a standards-checking code analyzer, the CodeCheck product from Abraxus Software will check C source code for both lexical style and specific usage rules. The rules are specified external to the analyzer program and can be modified or extended to meet specific organizational standards.

Debugging Is a Waste of Time

The C and C++ world is awash with slick debuggers. But before you place a debugger high on your list of C/C++ tools, consider this fact: Every minute spent using the debugger is a waste of time - nothing is being produced. The place to control errors in C programs is during production, not by debugging.

This is not to say you shouldn't have a good C debugger - most compiler products come with one anyway. But don't plan to use the debugger as a tool to improve your C productivity. That's a self-defeating strategy.