On 6/14/15 7:02 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <[email protected]>"
wrote:
On Saturday, 13 June 2015 at 22:07:26 UTC, deadalnix wrote:
On Saturday, 13 June 2015 at 11:32:20 UTC, rsw0x wrote:
http://dlang.org/garbage.html
Do not take advantage of alignment of pointers to store bit flags in
the low order bits:
p = cast(void*)(cast(int)p | 1); // error: undefined behavior
if this restriction is actually imposed - why does
std.bitmanip.tagged{ClassRef,Pointer} even exist?
That seems like an arbitrary limitation. This will create an interior
pointer, which the GC needs to recognize anyway.
The doc need to be updated.
I see David Nadlinger already said so in the PR, but that's how I
understand it:
AFAIU the purpose of this restriction is to allow the GC to take
advantage of alignment: a pointer with the lowest bit set cannot point
to a 4-byte aligned struct, for example.
Huh? Of course it can!
struct S
{
ubyte[4] arr;
int x;
}
auto s = new S;
auto p = &s.arr[1]; // points at an S in memory.
I don't see how GC can take any advantage of this.
-Steve