Stu Bell wrote:
> Jim Brain wrote:
> [...]
>> Can someone clarify why these macros are preferred over doing 
>> cli()/sei()/SREG=sreg in code?  I'm not trying to troll, but 
>> wonder if there is something I am missing.
> [...]
> More important, in my mind, is that the macros are written in such a way
> that the enclosed code is guaranteed not to be optimized out of the
> block.

This for me is the most important and most surprising point to newbies:
code can be moved out of a cli() / sei() block by compiler optimizations
because sei() is not a compiler barrier at all (just search for a
previous thread '"cli" and "sei" should clobber memory').

> [...nice sum up of atomic_* advantages trimmed...]

-- 
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"All I ask is a chance to prove that money can't make me happy."


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to