Like Colin said, the C standard defines the semantics of the language
in terms of an abstract machine. Normally the compiler is allowed to
use an "as if" approximation of the semantics and leave out things
that would not change the state of the abstract machine.

One way to look at volatile is that it is a way to tell the compiler
that you know things that the compiler does not know, and therefore
the compiler needs to do things "by the book", i.e. do all the things
that the abstract machine semantics requires it to do.

I don't have an AVR compiler handy, but it would be instructive to see
what the compiler generates for "result = result*0" where result is
volatile.
-- 
Pertti

_______________________________________________
AVR-chat mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to