3 ms·
> This offset can then later be interpreted as "from the start of the struct" or "from the start of memory identified by the pointer to 0". The issue is, how d
by SkiFire13 2y ago
> This offset can then later be interpreted as "from the start of the struct" or "from the start of memory identified by the pointer to 0".
The issue is, how do you create such an offset, at comptime, such that you can interpet it as "from the start of memory identified by the pointer to 0" at runtime. Because at runtime you'll most often want to do the latter (and surely you don't want to branch on whether it's one or the other), but creating such offsets is the part that's very tricky if not impossible to do properly at comptime.
> I guarantee you that there's code just like this in the guts of any compiler that can reorder struct/record members
How is that relevant though? Ok, the code might look similar, but that's not the problematic part.