A.2 Coding errors


A.2 Coding errors

A.2.1 Initialization errors

  • A simple variable is always uninitialized.

  • A simple variable is sometimes uninitialized.

  • A simple variable is initialized with the wrong value.

  • An aggregate variable is always uninitialized.

  • An aggregate variable is sometimes uninitialized.

  • An aggregate variable is initialized with the wrong value.

  • An aggregate variable is partially uninitialized.

  • An aggregate variable is not allocated.

  • An aggregate variable is allocated the wrong size.

  • A resource is not allocated.

A.2.2 Finalization errors

  • An aggregate variable is not freed.

  • A resource is not freed.

A.2.3 Binding Errors

  • A variable is declared with the wrong scope.

  • A procedure call is missing arguments.

  • A procedure call has the wrong argument order.

  • A procedure call has extra arguments.

  • The actual argument passing mechanism does not match the usage of the formal argument.

  • A procedure returns no value.

  • A procedure returns the wrong value.

A.2.4 Reference errors

  • The wrong procedure is called.

  • The wrong variable is referenced.

  • The wrong constant is referenced.

  • The wrong variable is assigned.

  • A variable is not assigned.

A.2.5 Static data-structure problems

  • A simple variable has the wrong data type.

  • An element of an aggregate variable has the wrong data type.

  • An aggregate variable has the wrong aggregate size.

A.2.6 Dynamic data-structure problems

  • An array subscript is out of bounds.

  • An array subscript is incorrect.

  • An uninitialized pointer has been dereferenced.

  • A null pointer has been dereferenced.

  • A pointer to freed memory has been dereferenced.

  • An uninitialized pointer has been freed.

  • A pointer stored in freed memory has been dereferenced.

  • A null pointer has been freed.

  • A pointer to freed memory has been freed.

  • A pointer to static memory has been freed.

  • A pointer to automatic (stack) memory has been freed.

A.2.7 Object-oriented problems

  • A class containing dynamically allocated memory does not have the required methods.

  • A base class has methods declared incorrectly for the derived class to override.

  • The wrong method signature is used to invoke an overloaded method.

  • A method from the wrong class in the inheritance hierarchy is used.

  • A derived class does not completely implement the required func-tionality.

A.2.8 Memory problems

  • Memory is corrupted.

  • The stack is corrupted.

  • The stack overflows.

  • The heap is corrupted.

  • A pointer is invalid for the address space.

  • An address has an invalid alignment.

A.2.9 Missing operations

  • A return code or flag has not been set.

  • A return code or flag has not been checked.

  • An exception has not been thrown.

  • An exception thrown has not been handled.

  • An event sequence has not been anticipated.

  • A program state has not been anticipated.

  • Statements are missing.

  • Procedure calls are missing.

A.2.10 Extra operations

  • A return code or flag is set when not needed.

  • An exception is thrown when not valid.

  • Extraneous statements are executed.

  • Extraneous procedure calls are executed.

A.2.11 Control-flow problems

  • Statements are controlled by the wrong control-flow condition.

  • Loop iterations are off by one.

  • A loop terminates prematurely.

  • A loop runs indefinitely.

  • A case in a multiway branch is missing.

  • A multiway branch takes the wrong case.

  • A statement is executed too many times.

  • A statement is executed too few times.

A.2.12 Value-corruption problems

  • An arithmetic operation has underflow or overflow.

  • Precision is lost.

  • Signed and unsigned integers are mixed.

  • Floating-point numbers are compared incorrectly.

A.2.13 Invalid expressions

  • The wrong variable is used.

  • Operator input is invalid.

  • The wrong arithmetic operator is used.

  • The wrong arithmetic expression order is used.

  • The wrong relational operator is used.

  • The wrong relational expression order is used.

  • The wrong Boolean operator is used.

  • The wrong Boolean expression order is used.

  • A term is missing.

  • There is an extra term.

A.2.14 Typographical errors

  • Characters are missing.

  • There are extra characters.

  • Characters are out of order.

A.2.15 Other people’s problems

  • A compiler has been used incorrectly.

  • A software tool has been used incorrectly.

  • A system library has been used incorrectly.

  • A third-party library has been used incorrectly.

  • There is a defect in a system library.

  • There is a defect in a compiler.

  • There is a defect in a software tool.

  • There is a defect in the operating system.

  • There is a defect in the third-party software.




Debugging by Thinking. A Multidisciplinary Approach
Debugging by Thinking: A Multidisciplinary Approach (HP Technologies)
ISBN: 1555583075
EAN: 2147483647
Year: 2002
Pages: 172

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net