On Tue, 10 Feb 2009 21:56:39 +0100 (MET) [email protected] (Joerg Wunsch) wrote: > As the code works as is (with the warning), I bet the volatile > qualification wasn't needed at all in the first place, and could as > well be omitted.
I can't find any reference to the volatile keyboard in the current avr-libc manual (1.6.2), but my understanding of volatile comes from an older avr-libc manual (somewhere in the FAQ section IIRc) years ago when I debuted my AVR project. IIRC it said volatile must be used to keep the compiler from optimizing away access to a variable that he thinks might be pointless. Like writing a variable that is never read back. In my case I was writing to a buffer from an ISR, but it was not read in that C file, only from a different one, hence invisible to the compiler. So my understading was: "in that particular file, GCC sees that I am writing to the buffer, but never reading it, so he might think it's useless to write to it ! So I added the volatile keyword, thinking it would stop him from thinking too much ! ;-) Is my understanding of volatile wrong ? -- Vince _______________________________________________ AVR-GCC-list mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
