Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

Mysterious values in IDE when debugging

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alfonzo Morra - 14 Jul 2005 12:01 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.