avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AW: Fw: [avr-gcc-list] Pointer to byte in code.


From: E. Weddington
Subject: Re: AW: Fw: [avr-gcc-list] Pointer to byte in code.
Date: Fri, 16 Jul 2004 09:15:19 -0600

On 16 Jul 2004 at 12:00, Oliver Schulz wrote:

> Hi Lucio, 
> 
> your answer is really interesting, because this time it has nothing to do with
> 'volatile'. If you would have taken the time to compile the code snippet and
> have a closer look to it, you probably didn't post that useless answer..
> 
> 
> Now to the problem:
> 
> There is just a semicolon which is placed at the wrong place. The line:
> 
> while(data= pgm_read_byte(src++));
> 
> must be changed to:
> 
> while(data= pgm_read_byte(src++)) 
> 
> As you can see, no semicolon at the end of line. With this semicolon there is 
> no
> loop body and the assignment is executed just once, after the loop condition 
> is
> no longer true. Because dest isn't used after that assignment, the compiler
> removes the 'useless' increment.
> 
> Removing the semicolon reveals the correct loop body to the compiler and the
> code becomes a little bit longer...

My fault on that one. Thanks for catching that. It was quick one-off that 
wasn't tested.....

Eric


reply via email to

[Prev in Thread] Current Thread [Next in Thread]