Does associative array change the location of values?

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Oct 31 17:04:43 UTC 2021


On Sun, Oct 31, 2021 at 09:54:23AM -0700, Ali Çehreli via Digitalmars-d-learn wrote:
> On 10/31/21 9:49 AM, H. S. Teoh wrote:
> 
> > The current spec explicitly states that masking pointers this way is UB.
> 
> Ok. :) What about unions?
> 
> union U {
>   ulong u;
>   void* p;
> }
> 
> Can the GC deal with that?

https://dlang.org/spec/garbage.html#obj_pinning_and_gc


Though I have to say, object pinning does impose restrictions on a
moving GC implementation that may negate some of its benefits.


T

-- 
Never criticize a man until you've walked a mile in his shoes. Then when you do criticize him, you'll be a mile away and he won't have his shoes.


More information about the Digitalmars-d-learn mailing list