cancel
Showing results for 
Search instead for 
Did you mean: 

emergency_

irmakci2
Associate II
Posted on March 15, 2006 at 10:13

emergency_

4 REPLIES 4
irmakci2
Associate II
Posted on March 15, 2006 at 09:16

Hi

In fact we have some problems with cosmic c compilers

void x(void)

{

humi_val=humi_val*143 //doesn't give me right results

//humi_val is global unsigned int

}

luter
Associate II
Posted on March 15, 2006 at 09:31

it is just a common optimization. if u do not use this variable anymore compiler omits it.

ok, if u want your code to be compiled as it is, use ''volatile'' definition for such variable. it is just to show u what u want to see, but ussually ''volatile'' is used for several cases only. do not take it as rule for all cases.

i work with cosmis since 1 year and did not find any compiler errors.

irmakci2
Associate II
Posted on March 15, 2006 at 10:01

thank you for your care

irmakci2
Associate II
Posted on March 15, 2006 at 10:13

Hi.But what means optimizition exactly?how can I solve this problem from cosmic menus?and I know only this means volatile is used for hardware registers because registers is changed externally if I know correctly:).And as you said compiler doesnt optimize volatile variables but I dont know how ı can solve from menu:

If you help me I'd be happier

Thank you