Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: float in interrupt function?

2005-04-09 by Robert Adsett

At 11:31 AM 4/9/05 +0000, charlesgrenz wrote:
>When ever you use a global variable, you have to specify it as a
>volatile to tell the compiler not to opitmize the variable out of the
>equation when working with any ANSI C compiler.

Um, no.  The C compiler MUST assume that any global variable can change 
across a function call if it can't trace the call (ie if it's in a separate 
module).  Once a call is made outside of the compiler 'sight' all globals 
have to be considered changed by the compiler.

Now once a routine has read a global it can assume it's unchanged until 
it's made a function call unless it's declared as volatile.  But in this 
case volatile will make no difference.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.