alignment on stack-allocated arrays/structs
Robert Jacques
sandford at jhu.edu
Wed Nov 18 08:28:31 PST 2009
On Wed, 18 Nov 2009 11:03:19 -0500, Don <nospam at nospam.com> wrote:
> Trass3r wrote:
>> Don schrieb:
>>> http://d.puremagic.com/issues/show_bug.cgi?id=2278
>> Isn't this a distinct problem or am I wrong? This is not only about
>> 8-byte boundaries.
>
> Well, sort of.
> It's impossible to align stack-allocated structs with any alignment
> greater than the alignment of the stack itself (which is 4 bytes).
> Anything larger than that and you HAVE to use the heap or alloca().
>
> Since D2.007, static items use align(16); before that, they were also
> limited to align(4).
>
> Nothing on x86 benefits from more than 16 byte alignment, AFAIK, and
> it's never mandatory to use more than 8 byte alignment. I don't know so
> much about the recent GPUs, though -- do they really require 16 byte
> alignment or more?
>
NVIDIA only requires 16-byte alignment.
More information about the Digitalmars-d
mailing list