core.runtime.GC memory alignment

Peter Alexander peter.alexander.au at gmail.com
Sun Oct 27 12:51:01 PDT 2013


On Sunday, 27 October 2013 at 17:53:14 UTC, David Nadlinger wrote:
> On Sunday, 27 October 2013 at 16:19:28 UTC, Peter Alexander 
> wrote:
>> "The malloc() and calloc() functions return a pointer to the 
>> allocated memory that is suitably aligned for any kind of 
>> variable."
>>
>> I see no reason to diverge from that.
>
> Welö, except for the fact that "any kind of variable" is not 
> well-defined for a language that supports user-defined 
> alignment restrictions:

Correct me if I'm wrong, but my understanding is that align(N) on 
a member only specifies the alignment *within the struct*, i.e. 
the member offsets. There's no guarantee that the Foo object 
itself will be aligned to 8192. It's not really memory alignment.


More information about the Digitalmars-d mailing list