|
Re: Crazy Loops
Looking only a pseodo-code can lead one to erroneous results.
I once worked on a project where every module was coded, and had to have COMPLETE pseudo-code in the file header as well. Endless hours were spent making sure the two lined up.
Of course the programmers only looked at the code, knowing the pseudo-code would sometimes be wrong.
Recently I had a variable that mysteriously changed values, in a loop like yours. This was using MPLAB. Turned out there were two variables with exactly the same name, one in local scope and one in global scope. The compiler never hinted of the conflict (well, that's my story and I'm sticking to it!). Of course the global one was being updated (by an external .C routine) and the local one was read by the printf ... since it was on the stack and there were interrupts in the system, it always contained garbage.
|