[ale] g++ and c++: freeing unallocated space with delete

John Wells jb at sourceillustrated.com
Wed Nov 6 10:32:30 EST 2002


I have a program that manipulates various objects on the heap.  I recently
added a bug (unintentionally) in one of my modifications in which the
program tries to free unallocated space.  In other words, it calls delete
on an string pointer that hasn't been pointed anywhere.

The odd thing is, for a long time it worked just fine with no errors under
gcc/g++ 2.96.  Recently, I had to downgrade for other reasons to 2.95 and 
started getting seg faults, which led me to the culprit.

Why did this work before?  Do certain versions of gcc/g++ handle mistakes
like this for you?  And, if so, is there any way to turn this behavior
off, so that  no non-standard modifications are made?  I'd like this code
to be as standards compliant and possible, and if there are errors on my
part, I'd like to know about them.

Of course, it could be something else entirely. ;-)

Thanks for the help!

John




---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list