Regarding emplace, arrays, and helper functions
Andrej Mitrovic
andrej.mitrovich at gmail.com
Fri Aug 30 07:02:09 PDT 2013
On 8/30/13, Ali Çehreli <acehreli at yahoo.com> wrote:
> Now your program works with a single change:
>
> enum Size = paddedSize!C();
Excellent.
However will the compiler align all static arrays so their memory
begins at a proper offset?
Maybe a more appropriate question is: Is all stack data guaranteed to
be properly aligned, and on all platforms? For example:
enum Size = paddedSize!C;
ubyte[1] preBuffer;
ubyte[Size][2] buffer;
Is 'buffer' guaranteed to be aligned so its memory begins at a good
offset? There could be any number of bytes before 'buffer', such as
the preBuffer above it.
Tests show that they are indeed aligned, but I wonder if this is
something you can guarantee on all platforms?
More information about the Digitalmars-d-learn
mailing list