core.runtime.GC memory alignment

monarch_dodra monarchdodra at gmail.com
Sun Oct 27 14:23:40 PDT 2013


On Sunday, 27 October 2013 at 21:20:12 UTC, John Colvin wrote:
> On Sunday, 27 October 2013 at 20:50:30 UTC, monarch_dodra wrote:
>> 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
>
>> "alignment relative to the start of the struct"
>
> what does that even mean? Alignment means (address % alignment) 
> == 0
>
> what would be the use case for guaranteeing ((fieldAddress - 
> StructAddress) % alignment) == 0 that can't be just as easily 
> done using normal alignment

Observation shows that that's *how* align currently behaves 
anyways:
http://forum.dlang.org/thread/difcpyoejpbngzpoynce@forum.dlang.org#post-nhrvixioystchhdpmakg:40forum.dlang.org

Its like its incorrectly named, and actually specifies "paking". 
However, the two concepts seem packed into one, resulting in some 
confusing semantics and bahaviors.


More information about the Digitalmars-d mailing list