Alternatives
Members may post updates or alternatives to this current article in order to show different
approaches or add new features.
A good exercise to aid in always using delete [] where appropriate is to code your own autoarray_ptr following the pattern of c++ auto_ptr. The destructor calls delete [] when the instance goes out of scope. Saves writing a lot of messy delete [] code in "if chains" and switch blocks....
It is a bad idea to treat built-in types differently than programmer defined classes. If you delete a dynamically allocated array of a built-in type without the brackets the memory buffer may go away just fine. This is not guaranteed. The VS2008 runtime throws an exception. There is a...
31 Aug 2010elitehussar 3 alternatives
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.