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