On Fri, 25 Feb 2011 21:10:59 -0500, Jonathan M Davis <jmdavisp...@gmx.com>
wrote:
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
> int j;
> int[2] y;
> y[j] = j = 1;
I think that's undefined behavior in C and C++. It is not defined
whether j's previous or past value is used in y[j].
I would expect the situation be the same in D.
No, that should be perfectly defined. What's undefined is when you do
something
like func(j, y[j]). The evaluation order of the function arguments is
undefined.
However, the evaluation order when dealing with an assignment should be
defined.
I _could_ be wrong about that, but there's no question that the
assignments
themselves are guaranteed to be done in right-to-left order.
Let me fix that for you:
func(j++, y[j])
-Steve