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

cfowler cfowler at outpostsentinel.com
Wed Nov 6 10:57:15 EST 2002


Luck of the draw.  You just was able to screw up the stack with one
version instead of another.  I seen this happen on multiple platforms
too.  


On Wed, 2002-11-06 at 10:32, John Wells wrote:
> 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.
> 
> 
> 



---
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