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
David Lowndes - 15 Jul 2005 09:57 GMT
>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
[quoted text clipped - 3 lines]
>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
Alfonso Morra - 17 Jul 2005 09:25 GMT
>>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
[quoted text clipped - 11 lines]
>
> Dave
Hi Dave,
Thanks for reply - but no, this was my own code that I was running in
debug mode.
David Lowndes - 17 Jul 2005 09:54 GMT
>> Are you debugging a release optimised build rather than the debug
>> non-optimised build? The results you mentioned are typical when
>> debugging optimised builds.
>>
>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

Signature
MVP VC++ FAQ: http://www.mvps.org/vcfaq