Computer Algorithms II Lecture Notes

4 September 2008 • Dynamic Storage and C++


Proceeding as normal is not the right thing to do here, because the code shown is not exception safe. In particular, if the copy constructor throws an exception, the left-hand side is left pointing to no data.

Making assignments exception-safe is tricky and doing so goes beyond the intention of these notes. For more details on exception safety, see Here be Dragons by Alan Griffiths, the C/C++ User's Journal, March 2001.


This page last modified on 24 January 2006.