[LLVMdev] struct alignment question

Reid Kleckner rnk at google.com
Tue Nov 19 12:52:55 PST 2013


Maybe.  Usually people who want this do something like:

Y = { c, d, e }
X = { a, b, Y }


On Tue, Nov 19, 2013 at 12:04 PM, edA-qa mort-ora-y <eda-qa at disemia.com>wrote:

> 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/
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131119/f88e0abd/attachment.html>


More information about the llvm-dev mailing list