RE: [avr-gcc-list] Tip: handling volatile operands

2008-01-11 Thread Dave Hansen
From: [EMAIL PROTECTED] The point I was trying to make (poorly) was that io (and other variables) that may universally declared volatile, may in fact have values that need to be used in a non-volatile fashion. You have same problem with unrollable operations such as: if (ioport

Re: [avr-gcc-list] Tip: handling volatile operands

2008-01-11 Thread Dave N6NZ
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

Re: [avr-gcc-list] Tip: handling volatile operands

2008-01-10 Thread David Kelly
On Thu, Jan 10, 2008 at 02:24:46PM -0500, [EMAIL PROTECTED] wrote: I have come across a few instances where very inefficient c code is created by volatile operands - often accidentally and thru no fault of the compiler(s) ... For example: while (ioport != 0) { } ... If ioport were