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

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

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


From: Oliver Schulz
Subject: AW: Fw: [avr-gcc-list] Pointer to byte in code.
Date: Fri, 16 Jul 2004 12:00:46 +0200

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...

Cheers,
Oliver.





> -----Ursprüngliche Nachricht-----
> Von: address@hidden
> [mailto:address@hidden Auftrag von
> address@hidden
> Gesendet: Freitag, 16. Juli 2004 07:14
> An: address@hidden
> Betreff: Re: Fw: [avr-gcc-list] Pointer to byte in code.
> 
> 
> > No code is generated for "dest++" . Why is this?
> 
> I wonder what the average time interval is between questions of this
> nature?
> 
> Maybe we should have "VOLATILE" etched into the newsgroup name!
> 
> ++L
> 
> 
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
> 


reply via email to

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