avr-gcc-list
[Top][All Lists]
Advanced

[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,regressi


From: Graham Davies
Subject: Re: [avr-gcc-list] Wrong excution order in 4.1.1, but not 3.4.5,regression?
Date: Tue, 20 Feb 2007 07:04:16 -0500

David Brown wrote (in part):

... I don't know if the C standard is clear on expressions such as "a = b = c", when some or all of these are volatile ...

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.

At the risk of sounding patronising, I'd say that almost any code with
"a = b = c" expressions is incorrect code because it is far from clear
what you mean, and if volatiles are involved then it is undoubtedly wrong.

You don't sound patronizing, just wrong.

When the code is re-written to actually say what you mean, do you still get a difference?

This is a useful question/suggestion, however, and may shed some light on the problem.

Graham.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]