Following are more resources that cover unusual data types:
Maguire, Steve. Writing Solid Code. Redmond, WA: Microsoft Press, 1993. Chapter 3 contains an excellent discussion of the hazards of pointer use and numerous specific tips for avoiding problems with pointers.
Meyers, Scott. Effective C++, 2d ed. Reading, MA: Addison-Wesley, 1998; Meyers, Scott, More Effective C++. Reading, MA: Addison-Wesley, 1996. As the titles suggest, these books contain numerous specific tips for improving C++ programs, including guidelines for using pointers safely and effectively. More Effective C++ in particular contains an excellent discussion of C++'s memory management issues.
Considerations in Using Unusual Data Types
Structures
Have you used structures instead of naked variables to organize and manipulate groups of related data?
Have you considered creating a class as an alternative to using a structure?
Global Data
Are all variables local or of class scope unless they absolutely need to be global?
Do variable naming conventions differentiate among local, class, and global data?
Is the code free of pseudoglobal data—mammoth objects containing a mishmash of data that's passed to every routine?
Are access routines used instead of global data?
Are access routines and data organized into classes?
Do access routines provide a level of abstraction beyond the underlying data type implementations?
Are all related access routines at the same level of abstraction?
Pointers
Are pointer operations isolated in routines?
Are pointer references valid, or could the pointer be dangling?
Does the code check pointers for validity before using them?
Is the variable that the pointer references checked for validity before it's used?
Are pointers set to null after they're freed?
Does the code use all the pointer variables needed for the sake of readability?
Are pointers in linked lists freed in the right order?
Does the program allocate a reserve parachute of memory so that it can shut down gracefully if it runs out of memory?
Are pointers used only as a last resort, when no other method is available?
3.141.31.125