<div dir="ltr">On 29 October 2013 04:33, monarch_dodra <span dir="ltr"><<a href="mailto:monarchdodra@gmail.com" target="_blank">monarchdodra@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Monday, 28 October 2013 at 02:44:54 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I had a lot of informal conversations with Walter trying to get my head<br>
around the details here.<br>
To my recollection, the intent was that it should behave like C, and that<br>
S.alignof must certainly == 128 in that case. It can't work otherwise.<br>
Alignment must be inherited by parent structures.<br>
</blockquote>
<br></div>
But is that really what it means though? From the above conversation, it would instead appear to mean that:<br>
struct S<br>
{<br>
    int i;<br>
    align(128) int j;<br>
}<br>
in this case, the *padding* needed until we reach j is 128 bytes.<br>
<br>
It doesn't mean that S itself need to be 128 aligned.</blockquote><div><br></div><div>Both should be true, if it's not, it's a bug.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I also recall commenting on that case with ulong. On most architectures it<br>
only needs to be 4 byte aligned, but that one is arch specific.<br>
</blockquote>
<br></div>
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... ? </blockquote></div>
<br></div><div class="gmail_extra">Well SIMD vector's require at least 16 byte alignment, so say goodbye to a major subsection of your CPU ;)</div><div class="gmail_extra">I've never seen a malloc implementation that returns memory that is less than 16 byte aligned. If you expect higher alignment, typically you use OS provided AliognedAlloc primitives, or you use tricks like overallocating and offseting.</div>
</div>