|
The mistaken value is assigned to y when execute 'y = expression;'
in gdb, 'p y' will give the mistaken value after runing the above statement.
but ' p expression' gives the right value.
block2 and block3 are like this:
if(a->is_root) c = m2 - y2;
else f = m2 - y2;
As said before:
only one statement: if(a->is_root) c = m2 - y2; // y2 normal
only one statement: if(!a->is_root) f = m2 - y2; // y2 normal
but:
if(a->is_root) c = m2 - y2;
else f = m2 - y2;
or
if(a->is_root) c = m2 - y2;
if(!a->is_root) f = m2 - y2;
both make y2 abnormal. 'y2 = expression' is far away from if__ else __ structure
Thanks for your teaching
Last edited by cdbug; 11-23-2008 at 04:28 AM..
|