Question about garbage collection specification
Alex Parrill via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 15 08:49:21 PDT 2015
On Monday, 15 June 2015 at 15:33:41 UTC, rsw0x wrote:
>
> this doesn't make any sense, it's referring to an object p (of
> void*), not the location of p. It's setting the lsb of p to 1
> and claiming it's undefined behavior, when it's clearly not.
>
> Unless I misunderstand it.
`p` is assumed to be a pointer. `cast(int) p` gets the integer
representation of the pointer (though it should be `uintptr_t`
but whatever). It then does an integer bitwise or, then converts
the result back to a pointer.
It's undefined behavior in D because the spec just said so
(regardless of its defined behavior in C).
More information about the Digitalmars-d
mailing list