"Graham Davies" <[EMAIL PROTECTED]> wrote: > It is clear. The assignment operator has right-to-left > associativity so b = c is evaluated first. The result of an > assignment is the value assigned. So, the value assigned to b is > then assigned to a. I can't see how volatile could affect this, but > it certainly can't make things less well-defined.
As the volatile qualifier *only* demands the objects to be stable at sequence points, it's quite clear to me that the actual order the assignments might happen is not guaranteed by anything -- not even for volatile objects. The order of evaluation (which is what associativity is about) does not necessarily match the order of execution. Basically, if a and b have the same type, the order of evaluation doesn't matter at all, as it does not affect the result. This order only gets important if they have different types (as type promotion rules might become important then). So if you care about the sequence, you *have* to write: b = c; a = b; If a and b are qualified volatile, that would guarantee they are being written in exactly that order. Another way would be using the comma operator, as it also creates a sequence point. -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list