`std / lists` cannot be used for that either as the RC ops are not atomic and 
the pointer following does not use atomics.

> Even if the length changes during iteration, the code is still correct as we 
> will never touch memory we have not assigned & is not free'd back.

Likewise, the read from the length does not use `atomics.load` or similar so 
this would be undefined behavior. Yes, it's a machine word and yes the hardware 
guarantees an atomic load. That is not good enough, you need to tell the 
compiler explicitly or else it can reorder instructions so that your clever 
tricks fail.

Reply via email to