Dave Hansen wrote:
switch (ioport)
{
case 1: ...
case 2: ...
case 99: ...
}
This is (IMHO) a closer abstraction of what you actually want done.
But there is no general guarantee that the compiler won't turn a switch
into an if..then..else if... chain. It would be an interesting test of
the volatile keyword to see if declaring the switch variable volatile
has the effect of forcing a jump table.
It appears to me that this whole discussion is about is trying to cheap
out on critical sections by looking for locks that come for free under
specific circumstances with particular releases of the optimizer. Maybe
it is better to document the places where it isn't obvious that you need
a lock?
-dave
_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list