On Sat, 01 Nov 2014 11:43:11 +0000
via Digitalmars-d <[email protected]> wrote:

> If it's indeed caused by evaluation (which seems likely), then 
> it's not a bug. All expressions are supposed to be evaluated from 
> left to right.
this *IS* a bug. either compiler should error on this, or it shouldn't
modify random memory. imagine the situation when old array contents not
only collected by GC, but that memory was allocated to something
completely different.

and it's completely possible to fix this without dropping evaluation
order promise: take the address of hidden dynamic array structure first
and remember index, and take the address of array element just before
assigning. this way it will work as expected, and will evaluate
all indicies and the array address itself (not the address of the array
contents, but this is irrelevant to evaluation order) first.

what whay authors choose to fix this bug is irrelevant for me (but i
prefer the second way), but it MUST be fixed. either error, or do what
i described in the previous paragraph.

Attachment: signature.asc
Description: PGP signature

Reply via email to