View Single Post
  #6   Spotlight this post!  
Unread 20-03-2005, 13:45
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Printf Oddity : Programming Challange

These are the classic symptoms of a memory overwrite.

Usually the problem isn't caused by the statements you are fiddling with. Changing the "vital" statements simply causes things to be relocated/reorganized in the link map. I bet the overwrite is still happening, but it's probably overwriting unimportant locations now like unassigned space or variables that get initialized later anyway.

One way to track it down is to cause the error, look in the link map for the data memory location where you know the results are bad, then backtrack to see what is located before that corrupted memory location.

The cause, for instance, might be writing more values to an array than it is sized for. The extra values will clobber the next n memory bytes, one of which happens to be "vital", a static variable for example.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle