3.3. An Error Checklist for Inspections

An important part of the inspection process is the use of a checklist to examine the program for common errors. Unfortunately, some checklists concentrate more on issues of style than on errors (for example, "Are comments accurate and meaningful?" and "Are if-else, code blocks, and do-while groups aligned?"), and the error checks are too nebulous to be useful (such as "Does the code meet the design requirements?"). The checklist in this section was compiled after many years of study of software errors. The checklist is largely language independent, meaning that most of the errors can occur with any programming language. You may wish to supplement this list with errors peculiar to your programming language and with errors detected after using the inspection process.

3.3.1. Data Reference Errors

  1. Does a referenced variable have a value that is unset or uninitialized? This probably is the most frequent programming error; it occurs in a wide variety of circumstances. For each reference to a data item (variable, array element, field in a structure), attempt to "prove" informally that the item has a value at that point.

  2. For all array references, is each subscript value within the defined bounds of the corresponding dimension?

  3. For all array references, does each subscript have an integer value? This is not necessarily an error in all languages, but it is a dangerous practice.

  4. For all references through pointer or reference variables, is the referenced ...

Get The Art of Software Testing, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.