Exercises

10.1 Create a minimal C++ or C-based program that exhibits the orphaned allocation problem.

10.2 Create a minimal C++ or C-based program that exhibits the undetermined ownership problem. Then rectify the problem by using smart pointers.

10.3 Create a minimal C++ program that exhibits the insufficient destructor problem and then correct it.

10.4 Create a minimal C++ program that exhibits the incorrect assignment problem and then correct it.

10.5 Write a simple C program that performs some allocation and deallocation of memory, and make sure that it uses realloc() . Then use the techniques from this chapter to make all the memory handling functions location-sensitive (using __FILE__ and __LINE__ ) and write into a log all memory transactions (you can use the logging functions from Appendix D).

10.6 Extend the program from Exercise 10.5 to include localization tracing by using a stack for function names (see Appendix C).

10.7 Write a simple C++ program incorporating smart pointers that use nonintrusive reference counting, and have them written into a log (you can use the logging functions from Appendix D).



Memory as a Programming Concept in C and C++
Memory as a Programming Concept in C and C++
ISBN: 0521520436
EAN: 2147483647
Year: 2003
Pages: 64

Similar book on Amazon

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