> There is a good point to note here, which catches a lot of 
> people out. 
> GCC is a pretty smart compiler. It will seek out and remove a lot of 
> redundancy. However, this means the programmer has to be more exact 
> about what they write. You can be pretty sloppy writing for 
> IAR, as it 
> fails to optimise away a number of redundant things GCC will. If 
> something is volatile, you'd better make darned sure you 
> declare it as 
> such, or you will have problems.

Sometimes even declaring the variable volatile fails to work for me. It
still sits in a register and is never updated. I had to move the
comparison into a separate function. I believe, that works because  gcc
does not (?) optimize over function calls.

Sergei



Reply via email to