Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: chaomengqing on July 03, 2008, 04:02:51 am
-
hi~
when i debuging, the variable seems to be strange.
like the follow,
a=b+c+d; //a,b,c,d are functions
i have break here to see the assignation of 'a', but i find that 'a' is different from 'b+c+d', as 'a' is 0.42 and 'b+c+d' is 1.09 in watches. Then i don't know which one is the right answer i'm looking for. Also 'a' is always changed when 'b''c''d' has been changed in next sentence.
Is there anything i should do before debuging?
Thank you if you can help me with that as i'm new with this software. :P
-
The program stops on the breakpoint before the marked line is executed. Press F7 - is the value of 'a' correct?. What you probably need is to set the breakpoint one line below to see the correct result.
-
thank you for your answer.
i make the breakpoint at this sentence and press F7 to the next, then the value of 'a' in watches change but it seems to be wrong, it doesn't equal to 'b+c+d'. And with my pressing of F7, 'a' is ofen change, i don't know why.
sometimes it show that 'a=-nan(0x8000000000000)' when 'b+c+d' is definite.
-
'a=-nan(0x8000000000000)' when 'b+c+d' is definite.
This is probably when a is not yet initialised and the calculation has not be done yet?!
Anyways - next time this happens please report the exact values and variable types of a, b, c and d to get a meaningful feedback. In the end the debugger is usually right so this most likely is not a problem with C::B.
-
calculation has been done yet.
the sentence is like this:
square =1.5*(vx*vx + vy*vy );
the variable type of 'square''vx'and'vy' is register double, 'vx' and 'vy' have been evaluated before.
when i go to the next sentence'dot_g=-gx*vx-gy*vy;', the value are 'square=0', '1.5*(vx*vx + vy*vy )=0.015' in watch
-
when i go to the next sentence'dot_g=-gx*vx-gy*vy;', the value are 'square=0', '1.5*(vx*vx + vy*vy )=0.015' in watch
So it is working? I don't see a NAN anymore...?!
-
it works well till now after i change register double to double. :? orz
thank you