D array expansion and non-deterministic re-allocation

Walter Bright newshound1 at digitalmars.com
Wed Nov 25 21:59:51 PST 2009


Steven Schveighoffer wrote:
> As long as the spec says changing length may expand the array to hold
> enough space, the optimizer can't, because the optimization would
> change the side effects of the function.  An optimizer should not
> change the outcome or side effects of a function.  It's not unheard
> of for an optimizer to eliminate important operations that it thinks
> are invalid, but in that case, it's a broken optimizer, I don't see
> why we would add this case.

The optimizer is free to change around implementation-defined-behavior 
and undefined-behavior. For defined-behavior, it can change things 
around as long as the observer cannot observe a change.

> This point brought up is a non-issue, an optimizer that changes the
> outcome/side effects of a function is a broken optimizer, end of
> story.

It can within the constraints of defined-behavior.



More information about the Digitalmars-d mailing list