Data Reference Errors

  1. Are all variables properly initialized? (are all instance variables initialized in all constructors?)
  2. Do all pointers have a legal value? (i.e. NULL or pointing to a valid location)
  3. Are pointers tested on being NULL where necessary?
  4. Alias problems? (e.g. several pointers pointing to the same object)
  5. Are there any off-by-one errors? (e.g. strings without terminating EOS byte)
  6. Could range bound errors occur? Eg: int array[max]; array[max]=0;
  7. Is garbage collection properly implemented? (e.g: are all dynamically allocated objects (by new) eventually deallocated (by delete)?) If not, does this represent an oversight?
  8. Are there any scope ambiguities? Do variable declarations hide other declarations? If yes, is this an oversight? E.g:
    class C {
      public: C() { object* o = new object; }
      private: object* o;
    };
    
  9. (C++ experts only:) Do all base classes have a virtual destructor? If not, does this represent an oversight?

slide: Data Reference Errors