enableStomping

Helper to smooth transition between D1 and D2 runtime behaviours regarding array stomping. In D2 appending to array slice after length has been changed results in allocating new array to prevent overwriting old data.

We use and actually rely on that behaviour for buffer re-usage. assumeSafeAppend from object.d enables stomping back but adding using this no-op wrapper in D1 code will save time on trying to find those extremely subtle issues upon actual transition.

All places that reset length to 0 will need to call this helper.

void
enableStomping
(
T
)
(
ref T[] array
)

Parameters

array T[]

array slice that is going to be overwritten

Meta