I’m debugging part of a large project in Visual Studio 2005, and stepping through the code line by line.
int speed = this->values.speed;
int ref = this->values.ref_speed;
After stepping past the first line, values.speed has a value of 61, but for some reason, speed is getting assigned the value 58. After the second line, values.ref_speed has a value of 58, but ref gets assigned the value 30.
When paused, you can see that the original values are in fact 61 and 58 respectively, but the values getting stored are different.
What is causing this behaviour?
This could happen if the definition of the values structure got changed in a header file and not all the object files got recompiled. Then the “map” of the structure your code in this file is using might not match the rest of the code’s. That could explain why one of the variables appears to have the other’s value.
Or the Visual Studio .pdb file didn’t get updated for some reason, and Visual Studio is looking in the old place for the variable.