473,503 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Weird debug behaviour

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;
}
Nov 17 '05 #1
3 1049
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" <va*****************@hotmail.com> wrote in message
news:40**********************@dreader2.news.tiscal i.nl...
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;
}

Nov 17 '05 #2
Val

"B0nj" <b@nj> wrote in message news:uI**************@TK2MSFTNGP09.phx.gbl...
| 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" <va*****************@hotmail.com> wrote in message
| news:40**********************@dreader2.news.tiscal i.nl...
| > 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 -
Nov 17 '05 #3
It does have a habit of getting itself confused, often simply restarting the
IDE can have the same effect.
"Val" <va*****************@hotmail.com> wrote in message
news:40**********************@dreader2.news.tiscal i.nl...

"B0nj" <b@nj> wrote in message news:uI**************@TK2MSFTNGP09.phx.gbl... | 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" <va*****************@hotmail.com> wrote in message
| news:40**********************@dreader2.news.tiscal i.nl...
| > 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 -

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
5370
by: Jon Combe | last post by:
I have created the following test SQL code to illustrate a real problem I have with some SQL code. CREATE TABLE JCTable ( CustomerName varchar(50) ) ALTER TABLE JCTable ADD CustomerNo int...
0
1335
by: Deutsche Dogge | last post by:
Hi. I'M having a weird problem with addign menuitems to a menu dynamically on the popup event of the menuitem containing the container of the menuitems i wanna add (tools -> external -> {list of...
10
2035
by: Chris Mantoulidis | last post by:
I see some really weird output from this program (compiled with GCC 3.3.2 under Linux). #include <iostream> using namespace std; int main() { char *s; s = "test1"; cout << "s = " << s << "...
5
1450
by: Naveen Parihar | last post by:
I've a binary that runs on most of our servers but segfaults on one of the servers. Further, even on this specific machine, the binary runs successfully sometimes but segfaults most of the time....
8
1424
by: Deano | last post by:
Here's the code; Private Sub txtTeachName_LostFocus() If IsNull(Me.txtName) Then 'line A Forms!frmMainform!frmSubform.Locked = True GoTo Exit_txtName Else 'line B...
8
1530
by: Daniel Yelland | last post by:
Hi, I have developed a number of code libraries in Win32 DLLs and have written a number of test suite executables that implicitly link to these libraries in order to test them. In one of my test...
10
1831
by: Bonj | last post by:
Hello. I hope somebody can help me on this, because I'm running out of options to turn to. I have almost solved my regular expression function. Basically it works OK if unicode is defined. It...
12
2176
by: Mick_fae_Glesga | last post by:
OK, the solution to this is probably blindingly obvious to everyone, but... surely it can't be right. I am compiling with borland bcc32 free compiler this piece of code is designed to identify...
2
1956
by: TamaThps | last post by:
Hi, I'm using visual studio 2008 and normally when I get an error it shows what line it is on and which file etc. The error I'm getting I don't know how to solve or even what the problem is. This...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.