core.runtime.GC memory alignment
monarch_dodra
monarchdodra at gmail.com
Sun Oct 27 13:50:29 PDT 2013
On Sunday, 27 October 2013 at 20:30:05 UTC, Andrei Alexandrescu
wrote:
> Yah, something like that. I found align(NNN) underspecified and
> underpowered for my work with allocators. As a simple matter,
> NNN must be a literal, not a compile-time expression. You can't
> even write e.g. align(size_t.alignof), which is fairly basic.
>
>
> Andrei
In that case, we also need to specify how alignOf works. For
example:
struct S
{
align(128) int i;
}
static assert(S.alignOf == 128);
If "align(N)" is supposed to only mean "alignement relative to
the start of the struct", why the heck is S's "alignOf" 128?
Also, (but I can't double check it right now), I seem to remember
that there are odd things, like "ulong.alignOf == 8", yet if you
declare one on the stack, you notice it's only 4 aligned (at
least, on my win32 (I think) it is...)
More information about the Digitalmars-d
mailing list