I know globals are generally a bad idea, I just use them for debugging purposes on occasion.
I have a global variable that is clearly (I checked this multiple times, in multiple ways) not being accessed by any other part of the program. But the value of the variable is being modified somehow, from time to time.
I'm trying to list possible reasons for why this could be happening. My best guess right now is memory corruption. In particular, perhaps writing past the end of an array.
If you think it's memory corruption you can set a data breakpoint to find the reason. Start the debugging session by pressing F10, find the address to that global and then use Debug/New Breakpoint/New Data Brakepoint
Last edited by S_M_A; August 23rd, 2012 at 11:05 AM.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan