[Top][All Lists]

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

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

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Program Space String & optimization
Date: Thu, 15 Dec 2005 07:11:00 +0100 (MET)

David Kelly <address@hidden> wrote:

> Believe that is correct. But the other thing that was tripping him
> is in general all function calls are effectively volatile as well.

That's not entirely true.  For standard library functions, if the
compiler knows exactly the result (and knows it has no side effects),
it can do whatever would have happened instead actually calling the
function.  Consider the pgm_read_*() "functions" to be similar to that
in behaviour: the compiler knows exactly what needs to be done here.

Likewise, GCC can analyze simple functions, and notice they don't have
side effects, and return a constant result, and then skip multiple
invocations if it has the result `cached' still.

> If the function is inlined then all bets are off.

A true inlined function should behave identical to a non-inlined one.
But of course, macros are different here.

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

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