Additional Resources

 < Free Open Study > 

cc2e.com/1385

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.

cc2e.com/1392

Checklist: 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?

  • Are all global variables documented?

  • 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?


 < Free Open Study > 


Code Complete
Code Complete: A Practical Handbook of Software Construction, Second Edition
ISBN: 0735619670
EAN: 2147483647
Year: 2003
Pages: 334

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