Weird debug behaviour

  • Thread starter Thread starter Val
  • Start date Start date
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;
}
 
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.
 
| 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 -
 
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
 
Back
Top