N
Neil
I used IAR (v3.2 Evaluation)for first time and found that the assignment
operator was not "working" on local variables, particularly in main(). If I
moved the variable outside of main(), making them global, all worked ok??
heres an example...
unsigned char LegSensors = 0x00;
int main(void)
{
unsigned char var1;
DDRA = 0x00;
LegSensors = PINA;
var1 = var1 + 1;
return 0;
}
Now, this compiles fine, although if I had used var1++ the compiler warns
about var1 being set but never used. In fact, during debug, var1=var1+1 does
not even exist (nor would var1++).
This assignment operator issue also occurs when trying to assign the return
value from a function to a variable declared locally. ie myvar =
value_returning_funtion();
Is this an eval version thing, some config thing I am overlooking, or does
IAR do this all the time?
Thanks
Neil
operator was not "working" on local variables, particularly in main(). If I
moved the variable outside of main(), making them global, all worked ok??
heres an example...
unsigned char LegSensors = 0x00;
int main(void)
{
unsigned char var1;
DDRA = 0x00;
LegSensors = PINA;
var1 = var1 + 1;
return 0;
}
Now, this compiles fine, although if I had used var1++ the compiler warns
about var1 being set but never used. In fact, during debug, var1=var1+1 does
not even exist (nor would var1++).
This assignment operator issue also occurs when trying to assign the return
value from a function to a variable declared locally. ie myvar =
value_returning_funtion();
Is this an eval version thing, some config thing I am overlooking, or does
IAR do this all the time?
Thanks
Neil