Mysterious values in IDE when debugging

  • Thread starter Thread starter Alfonzo Morra
  • Start date Start date
A

Alfonzo Morra

Hi,

I recently started using VC7.1 (upgraded from VC6). I've noticed that
when stepping through code, some of the values of my variables make no
sese at all. For instance, I had some code like this:

int i = 1, j =1 ;
for ( MyClass::ResultType::const_iterator ResultIt =
ShowAll.getResults().begin(); ResultIt != ShowAll.getResults().end();
++ResultIt, i++ ) {
.......
cout << "Value of i is : " << i << endl ;


When I hovered my mouse ptr over the variable i, in the 'for'
expression, I got a nonsensical number: 2012749653 - however the value
printed on the console was correct.

When I "dragged" the variable named i to the watch window, I got the ff
error message: "i CXX0069: Error: variable needs stack frame", and this
was still within the for loop, so the i variable must have still been on
the stack - any body care to shed some light on wtf is going on?

Thanks
 
I recently started using VC7.1 (upgraded from VC6). I've noticed that
when stepping through code, some of the values of my variables make no
sese at all. For instance, I had some code like this:
...
When I hovered my mouse ptr over the variable i, in the 'for'
expression, I got a nonsensical number: 2012749653 - however the value
printed on the console was correct.

Alfonzo,

Are you debugging a release optimised build rather than the debug
non-optimised build? The results you mentioned are typical when
debugging optimised builds.

Dave
 
David said:
Alfonzo,

Are you debugging a release optimised build rather than the debug
non-optimised build? The results you mentioned are typical when
debugging optimised builds.

Dave

Hi Dave,

Thanks for reply - but no, this was my own code that I was running in
debug mode.
 
Are you debugging a release optimised build rather than the debug
Thanks for reply - but no, this was my own code that I was running in
debug mode.

Have you checked the compiler optimisation setting is set to /Od for
the source file(s)/project in question?

Dave
 
Back
Top