core.runtime.GC memory alignment

monarch_dodra monarchdodra at gmail.com
Mon Oct 28 11:33:48 PDT 2013


On Monday, 28 October 2013 at 02:44:54 UTC, Manu wrote:
> I had a lot of informal conversations with Walter trying to get 
> my head
> around the details here.
> To my recollection, the intent was that it should behave like 
> C, and that
> S.alignof must certainly == 128 in that case. It can't work 
> otherwise.
> Alignment must be inherited by parent structures.

But is that really what it means though? From the above 
conversation, it would instead appear to mean that:
struct S
{
     int i;
     align(128) int j;
}
in this case, the *padding* needed until we reach j is 128 bytes.

It doesn't mean that S itself need to be 128 aligned.

> I also recall commenting on that case with ulong. On most 
> architectures it
> only needs to be 4 byte aligned, but that one is arch specific.

Does it make sense (and should it be illegal) in that case to 
have anything with alignment > 8 ? I just don't see how something 
like "malloc" would be able to deal with them otherwise... ?


More information about the Digitalmars-d mailing list