[LLVMdev] struct alignment question

edA-qa mort-ora-y eda-qa at disemia.com
Tue Nov 19 12:04:40 PST 2013


On 19/11/13 08:03, Caldarale, Charles R wrote:
>> X = { a, b, c, d, e }
>> Y = { c, d, e }

> In general, no.  If a, b, and c were char, and d was an int, using
> typical C alignments, there would be one slack byte between c and d
> in X, whereas there would be three in Y.  You could probably force
> what you want with packed structures or by playing with the data
> layout setting.

Yes, I forgot about the simple scenario. If I force the alignment on "c"
should I be okay? That is, if I force it to the maximum alignment for
the platform will { c, d, e } always have the same layout?



-- 
edA-qa mort-ora-y
Leaf Creator

Leaf - the language we always wanted
http://leaflang.org/



More information about the llvm-dev mailing list