[Top][All Lists]

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

Re: [avr-chat] Missed Optimisation ?

From: Erik Christiansen
Subject: Re: [avr-chat] Missed Optimisation ?
Date: Wed, 2 Mar 2011 01:38:29 +1100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Tue, Mar 01, 2011 at 03:11:14PM +0100, address@hidden wrote:
> On Wed, 2 Mar 2011 01:04:44 +1100
> Erik Christiansen <address@hidden> wrote:
> > IANA "volatile" expert, but understand that "[hardware|other thread]
> > may change the value while this code is executing" is a legitimate
> > view of the compiler's perspective. In that case, the whole value
> > must be read and rewritten, to avoid composite values, partly
> > software created, and partly hardware-(or alternate thread)-written.
> > reading and writing only some bytes is not a reliable option with a
> > predictable outcome.
> OK, neither am I a. But if the whole value must be read and rewritten
> the compiler better insert interrupt disable/enable for volatiles
> larger than 8 bits.

If that isn't needed, then it's not a volatile, I think.
(Because it's in RAM, so only another thread/ISR can intrude.
 Hardware writes don't apply in this case.)


reply via email to

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