Eval order, bug or design decision?

Jarrett Billingsley kb3ctd2 at yahoo.com
Sat Mar 8 08:02:09 PST 2008


"Frank Benoit" <keinfarbton at googlemail.com> wrote in message 
news:fqubu4$2d2e$1 at digitalmars.com...
> int[] a1, a2;
> // ....
>
> int idx = 0;
> a1[idx] = a2[idx++];
>
> In Java this has another result like in D.
> Java will evaluate from left to right, D does the increment befor doing 
> the assignment, so the copied values go into different fields.
>
> Is this a bug or design decision?

http://www.digitalmars.com/d/1.0/expression.html

Very first section.  It's illegal code but it's up to the compiler to detect 
it or not.  I guess you could file a bug about it as "accepts-invalid". 





More information about the Digitalmars-d mailing list