Weird debug behaviour

V

Val

In vc7 (studio 2002), when I try to debug the first "if" statement, the IDE jumps to the next valid line and evaluates it even
if the if-statement is false. What is going on?

if( (theDealer.m_nPoints == 15) && (theDealer.Hand.size() == 2) ) //Break Point set here but...
{
vector<Card>::iterator vdi; // ... runs to here once debugging starts. Even if false is returned initially.
vdi = find_if( theDealer.Hand.begin(), theDealer.Hand.end(), SpecificValueCheck(14) );
if (vdi != theDealer.Hand.end())
return true;
}
 
B

B0nj

Check that it's not in 'release' mode. You can still debug in release mode,
but weird things will happen. It doesn't necessarily mean that in Release
mode it would take a 'shortcut' to there once the if statement had been
evaluated, and would jump into the if block regardless - it simply means the
debugger hasn't got a clue what's going on as the exe may be optimized and
hasn't got pdb symbols in it.


Val said:
In vc7 (studio 2002), when I try to debug the first "if" statement, the
IDE jumps to the next valid line and evaluates it even
if the if-statement is false. What is going on?

if( (theDealer.m_nPoints == 15) && (theDealer.Hand.size() == 2) ) //Break Point set here but...
{
vector<Card>::iterator vdi; // ... runs to here once debugging starts.
Even if false is returned initially.
 
V

Val

| Check that it's not in 'release' mode. You can still debug in release mode,
| but weird things will happen. It doesn't necessarily mean that in Release
| mode it would take a 'shortcut' to there once the if statement had been
| evaluated, and would jump into the if block regardless - it simply means the
| debugger hasn't got a clue what's going on as the exe may be optimized and
| hasn't got pdb symbols in it.
|
|
| | > In vc7 (studio 2002), when I try to debug the first "if" statement, the
| IDE jumps to the next valid line and evaluates it even
| > if the if-statement is false. What is going on?
| >
| > if( (theDealer.m_nPoints == 15) && (theDealer.Hand.size() == 2) ) //Break
| Point set here but...
| > {
| > vector<Card>::iterator vdi; // ... runs to here once debugging starts.
| Even if false is returned initially.
| > vdi = find_if( theDealer.Hand.begin(), theDealer.Hand.end(),
| SpecificValueCheck(14) );
| > if (vdi != theDealer.Hand.end())
| > return true;
| > }
|

Hmm, this was a VC6 project containing STLport 4.6.2, ported to VC7. What I did was deleting all files except for the
source/headers. Then I created a new managed C++ project from start. Now it works again.
I don't know why the debugger didn't have a clue.

Thank you for your help, much appreciated!

- Val -
 
B

Beeeeeves

It does have a habit of getting itself confused, often simply restarting the
IDE can have the same effect.


Val said:
| Check that it's not in 'release' mode. You can still debug in release mode,
| but weird things will happen. It doesn't necessarily mean that in Release
| mode it would take a 'shortcut' to there once the if statement had been
| evaluated, and would jump into the if block regardless - it simply means the
| debugger hasn't got a clue what's going on as the exe may be optimized and
| hasn't got pdb symbols in it.
|
|
| | > In vc7 (studio 2002), when I try to debug the first "if" statement, the
| IDE jumps to the next valid line and evaluates it even
| > if the if-statement is false. What is going on?
| >
| > if( (theDealer.m_nPoints == 15) && (theDealer.Hand.size() == 2) ) //Break
| Point set here but...
| > {
| > vector<Card>::iterator vdi; // ... runs to here once debugging starts.
| Even if false is returned initially.
| > vdi = find_if( theDealer.Hand.begin(), theDealer.Hand.end(),
| SpecificValueCheck(14) );
| > if (vdi != theDealer.Hand.end())
| > return true;
| > }
|

Hmm, this was a VC6 project containing STLport 4.6.2, ported to VC7. What
I did was deleting all files except for the
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top