[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regress
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression? |
Date: |
Tue, 20 Feb 2007 23:28:08 +0100 (MET) |
"Graham Davies" <address@hidden> 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] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Bob Paddock, 2007/02/19
- RE: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5,regression?, Eric Weddington, 2007/02/19
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Bob Paddock, 2007/02/19
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, David Brown, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5,regression?, Graham Davies, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Dave Hansen, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, David Brown, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5,regression?, Graham Davies, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, David Brown, 2007/02/21
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?,
Joerg Wunsch <=
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Bob Paddock, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Bob Paddock, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Dave Hylands, 2007/02/20
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Joerg Wunsch, 2007/02/21
- AW: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Haase Bjoern (PT-BEU/EMT), 2007/02/21
- Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5, regression?, Joerg Wunsch, 2007/02/21