I can not explain this, can you?

strange behavier during debuging.

class xxx
{
...
private a;
private b;
private function()
{
...
b = false;
...
}
...
}

I searched the whole project for variable a and put a break point at each place. then when I debut and step through the "b=false;", the value of a got changed in the watch window. I mean just before the statement, a is empty and right after the statement a got some value. program never break else where.

can anybody explain?
[520 byte] By [tangjun] at [2007-11-20 1:19:09]
# 1 Re: I can not explain this, can you?
Sounds like you overrite 'a' from somwhere in your code.
Since you didn't provide enouph information about your class xxx member variables/methods, nor showed your actual code there is impossible to answer you more... :sick:
VictorN at 2007-11-10 23:18:54 >
# 2 Re: I can not explain this, can you?
can anybody explain?
1) You are running a different executable than the one you believe you're debugging (i.e. the source code does not match what you're actually running).

OR

2) You have optimizations turned on. Since optimizations can eliminate or move code around, your source code does not match what the final optimized code would perform.

OR

3) Your code has a serious bug.

Those are three of your possibilities.

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-10 23:19:54 >
# 3 Re: I can not explain this, can you?
Add one more to it (since actual code is not provided) :

a is a reference to b.
exterminator at 2007-11-10 23:20:49 >
# 4 Re: I can not explain this, can you?
Paul's point make some sence, I will try explore a little bit, although I don't believe that's the reason.

for all others, I'v pointed out that I searched all my project where a is ever get assigned/modified, and I am sure I covered everything, and those break point never got reached during that call.

BTW, this is c# code.
tangjun at 2007-11-10 23:21:54 >
# 5 Re: I can not explain this, can you?
post the project and we can stop guessing on what might be the cause.
cvogt61457 at 2007-11-10 23:22:58 >
# 6 Re: I can not explain this, can you?
not possible, this is a 800MB project.
tangjun at 2007-11-10 23:23:57 >
# 7 Re: I can not explain this, can you?
1. If the option "Rebuild All" exists for the c# - try it.
2. Try to remove parts of the project until this strange behaviour goes away - then try to understand what could cause this...
VictorN at 2007-11-10 23:25:01 >
# 8 Re: I can not explain this, can you?
Victor,

Does "a" become the value of "b"? Or just some random value?

-Greg Dolley
greg_dolley at 2007-11-10 23:26:01 >
# 9 Re: I can not explain this, can you?
Victor,

Does "a" become the value of "b"? Or just some random value?

-Greg DolleyWhy are you asking me? :confused:
Ask OP! :cool:
VictorN at 2007-11-10 23:26:58 >
# 10 Re: I can not explain this, can you?
a has no relationship whatsoever with b.
tangjun at 2007-11-10 23:27:59 >
# 11 Re: I can not explain this, can you?
Have you tried my suggestions from yesterday?
VictorN at 2007-11-10 23:29:03 >
# 12 Re: I can not explain this, can you?
It sounds like memory is getting trounced.

Put a breakpoint on the MEMORY for A, not the variable A. Put the condition on the break point, whenever it changes.

Whenever any code, anywhere, alters that memory, the compiler will stop on it and you can see where its all happening.
DeepT at 2007-11-10 23:30:01 >
# 13 Re: I can not explain this, can you?
a has no relationship whatsoever with b.Would you mind showing a cut down version of the code that depicts this behaviour? Without that, it no more than you are asking us to blind-guess.
exterminator at 2007-11-10 23:31:07 >
# 14 Re: I can not explain this, can you?
Why are you asking me? :confused:
Ask OP! :cool:

Oh! Sorry Victor, my mistake. :blush:

Greg Dolley
greg_dolley at 2007-11-10 23:32:09 >
# 15 Re: I can not explain this, can you?
Oh! Sorry Victor, my mistake. :blush:

Greg DolleyNo problem! :)
VictorN at 2007-11-10 23:33:01 >
# 16 Re: I can not explain this, can you?
why don't you declare a variable 'a' on the first line of your winmain function. then the compiler should take you to where the other a is declared?
dave2k at 2007-11-10 23:34:05 >