470,858 Members | 1,727 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,858 developers. It's quick & easy.

conditional jump or move depends on uninitialised value(s)

I am using valgrind leak memory to check my program this message appears a lot of time, the program works but why this message.
example code
Expand|Select|Wrap|Line Numbers
  1. double RandNum,pp;  
  2.     double axis=AXIS;
  3.     double wise_profit=0.20;
  4.     double mu, delta,a,b;
  5.     double sattisfic_price;
  6.   RandNum=Rand.getRandomFloat();
  8.     if(prod_size<=prod_sold && prod_sold>0) SetPrice(GetPrice()+axis*RandNum); 
  9.     else if(prod_size>prod_sold && prod_sold>0)
  10.     {
  11.         mu=wise_profit*interestrate*satisfic_wage*numworkers;
  12.         delta=prod_size*prod_size*(1-mu/(interestrate*satisfic_wage*numworkers));
  13.         a=(-prod_size*prod_size)/(4*interestrate*satisfic_wage*numworkers);
  14.         b=prod_size;
  15.         sattisfic_price=(-b-sqrt(delta))/(2*a); <<-------- Here is the error
  16.         SetPrice(sattisfic_price);
  17.     }  
Jan 24 '08 #1
1 4329
The problem cannot be deduced from the given sample code. It is likely that the reported error indicates your given problem - that is, you are calling a subroutine or have placed a call to a subroutine (etc.) based on a variable of which the value you have not set.

In computing, an uninitialized variable is a variable that is declared but is not set to a definite known value before it is used. It will have some value, but not a predictable one. As such it is a programming error and a common source of bugs in software.
Feb 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Andrew L | last post: by
13 posts views Thread by santosh | last post: by
19 posts views Thread by Ulrich Eckhardt | last post: by
13 posts views Thread by Neal Becker | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.