Possible duplicate:Why do I see strange values when printing uninitialized variables?Functions with Uninitialized Variables and the Compiler (GCC)
I want to know about a mysterious problem that I encountered while solving a code problem.
The code that is present in production has an uninitialized logical variable, and the library checks the value of this Boolean. In a LIVE site, this variable behaves like TRUE always. The same code in the development environment behaves like FALSE always.
I know that due to differences in the environment between LIVE and DEV, the uninitialized bool variable may be undefined.
But here is my problem.
If I put the log statement in the code, compile it and put the binary in the development environment, the bool variable will always have TRUE, while FALSE with the code in LIVE.
How does a log expression affect the value of an uninitialized bool variable? I would like to know the possibilities.
- , , . , " " . , , , , , . , , , , bools .
, , false ( , : , bool bool, -, false - ).
, , undefined, , , (, , "" , ). , , , , , .
, printf . "heisenbug" , heisenbug .
printf
:
bool undefined.
: " bool undefined."
, , , undefined. , . , : undefined. , , - , , , (.. ) ..
, bool, .