Mail Archives: djgpp/1995/10/15/05:57:07
I'm using djgpp 1.12 M4. As part of a learning exercise, I've defined a
class which allocates memory in the constructor, and deletes it in the
destructor. I've then defined a function which takes one parameter of this
class, and returns an object of the same class. The intent is to
deliberately break the code (I want to see what happens when I later free
which should already be freed memory, not to mention accesing this
memory).
Anyway, what I see is that the memory is freed twice with no problem, and
that the contents (a simple string) are still accessible. In other
words, it appears that delete [] is not doing its job (would we normally
expect a NULL pointer?).
This may be related to an earlier post on realloc, etc...
I hope my explanation is clear enough. Remember that I'm trying to
induce an error.
Thanks.
--
---------------------------------------------------------------------
Michael Wesolowski (mewesolo AT freenet DOT calgary DOT ab DOT ca)
- Raw text -