News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Debugging Question

Started by GJC, September 04, 2009, 11:09:59 AM

Previous topic - Next topic

GJC

Why does the debugger stop/break at code within 'if' statements when conditions are not met.?
Hopefully i am doing something strange or incorrectly but would appreciate any help. For example
every time i run in debug mode the debugger breaks within statements that aren't met such
as

if (x==5)
{
y++; //with a breakpoint here
}

the compiler/debugger stops everytime even tho x != 5

Seronis

I'm sorry but using the following test program i was not able to reproduce your problem.


#include <iostream>

using namespace std;

int testFunc() {
int x = 10;
if( x == 5 ) {
int y;
y = 9; //breakpoint set here
}
return x;
}

int main() {
    cout << "Hello world!" << endl;
    return testFunc();
}

MortenMacFly

Quote from: GJC on September 04, 2009, 11:09:59 AM
if (x==5)
{
y++; //with a breakpoint here
}
If "x" is a float or double (so not an integer) this behaviour is correct.

Neverteheless - if you want help post the whole program so we are able to reproduce. Otherwise I can oly say: It works well for me.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]