Today I've run across a rather strange error. Essentially what is happening is inside the function foo
the first parameter is being set to the pointer value of the pointer crosssegments
. So say crosssegments
is location at 0x0045 then iMeaninglessdata
will be set at 0x0045. If I take out iMeaninglessData
and simply have o1
as the first parameter than o1
will be equal to 0x0045. If I pause the debugger before the function is called iMeaningless
data and crosssegments
have different pointer addresses.
void Foo(int *iMeaninglessData, handle o1, handle o2, handle o3, int iHeight, int iProfileHeight, handle o4, std::vector<object> * crossSegments, int *iProfileArray)
{
//...code
}
Here is how I am calling the function:
std::vector<FormSummary> * crossSegmentsTop = new std::vector<FormSummary>();
int iZero = 0;
Foo(&iZero, o1, o2, o3, 10, 50, o4, crossSegmentsTop, iProfileArray);
I'm very confused as to how this could be happening. Do you think something could be happening to the stack?
Thank you,
Turns out it is a bug in the visual studio 2008 debugger when used with release mode versus debug mode. I'm generating the PDB file, but apparently until you use the value, such as in a command window, it doesn't correctly locate the pointer for the variable.