Hi all,
Not sure if this is a bug, or if what I'm trying to do is just incorrect
C syntax. Regardless, the compiler doesn't warn about the following:
void led_blinky()
{
static uint8_t value= 1;
value != value;//This is the problem line - always true
if(value)
{
PORTD &= ~(1<<7);
}
else
{
PORTD |= (1<<7);
}
}
If I change it to this it works:
void led_blinky()
{
static uint8_t value= 1;
value = (!value); //This works...
if(value)
{
PORTD &= ~(1<<7);
}
else
{
PORTD |= (1<<7);
}
}
Are these not fundamentally the same?
FYI: Using avr-gcc 3.4.3 on FC1 Linux.
Configured with: ../../source/gcc-3.4.3/configure -v --target=avr
--disable-nls --prefix=/tools/avr --with-gnu-ld --with-gnu-as
--enable-languages=c,c++ --quiet --with-dwarf2
Thread model: single
gcc version 3.4.3
Regards,
Gary Douglas