Joerg Wunsch wrote:
David Brown <david.br...@hesbynett.no> wrote:

Evaluating the result of "p |= BIT(b)" means carrying out the
or-assign, then reading the value of p and returning it.

You're right, I stand corrected.


That's certainly how /I/ interpret the way volatile works in such cases. I believe there is some uncertainty about how it should work in C++ - the same statement /may/ have a different interpretation in C and C++ when volatiles are sort-of read in this way.

All in all, the fact that even experts are not always accurate in such cases suggests that you should stay well away from such code - an explicit "if" is clear, works exactly as intended, and in some cases gives noticeably better code than a logically equivalent "?:" expression.



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

Reply via email to