控制数组对齐

9 views
Skip to first unread message

Jianzhang Peng

unread,
Dec 11, 2009, 7:51:11 AM12/11/09
to hell...@googlegroups.com
大家好,

请问如何控制数组对齐?
比如,我想让数组16字节对齐

谢谢!
--
Jianzhang Peng

Eric Fisher

unread,
Dec 13, 2009, 8:22:55 PM12/13/09
to hell...@googlegroups.com
可以参考一下gcc手册 http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html#Variable-Attributes

aligned (alignment)
This attribute specifies a minimum alignment for the variable or
structure field, measured in bytes. For example, the declaration:
int x __attribute__ ((aligned (16))) = 0;
causes the compiler to allocate the global variable x on a 16-byte boundary.

2009/12/11 Jianzhang Peng <pengji...@gmail.com>:

> --
>
> 您收到此邮件是因为您订阅了 Google 网上论坛的“HelloGcc Workshop”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 hell...@googlegroups.com
> 要取消订阅此网上论坛,请发送电子邮件至 hellogcc+u...@googlegroups.com
> 若有更多问题,请通过 http://groups.google.com/group/hellogcc?hl=zh-CN 访问此网上论坛。
>

Jianzhang Peng

unread,
Dec 13, 2009, 8:46:26 PM12/13/09
to hell...@googlegroups.com
谢谢!

2009/12/14 Eric Fisher <joefo...@gmail.com>



--
Jianzhang Peng
Reply all
Reply to author
Forward
0 new messages