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

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

Re: [avr-gcc-list] Program Space String & optimization


From: David Kelly
Subject: Re: [avr-gcc-list] Program Space String & optimization
Date: Wed, 14 Dec 2005 19:21:45 -0600


On Dec 14, 2005, at 8:57 AM, Joerg Wunsch wrote:

volatile PGM_P txt= P_Txt;

Your volatile qualifier is at the wrong place.  You're marking the
object "txt" points to as volatile, not the pointer itself.  Change
that into

PGM_P volatile txt = P_Txt;

and it will work.

Believe that is correct. But the other thing that was tripping him is in general all function calls are effectively volatile as well. Call a function and expect it will be called simply because you said to, the the optimizer probably won't descend into the function and decide it can be skipped. If the function is inlined then all bets are off.

        do{} while( (a=pgm_read_byte(txt)) );  // Wait for null char

While pgm_read_byte(txt) looks like a function call it is totally macro.

I don't believe this is a problem with the compiler at all, it did exactly what it was told it could do.

--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.





reply via email to

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