Are stack variables aligned by the GCC __attribute__((aligned(x)))?

i have the following code: #include int main(void) { float a[4] __attribute__((aligned(0x1000))) = {1.0, 2.0, 3.0, 4.0}; printf("%p %p %p %p\n", &a[0], &a[1], &a[2], &a[3]); } And i have the following output: 0x7fffbfcd2da0 0x7fffbfcd2da4 0x7fffbfcd2da8 0x7fffbfcd2dac Why the address of `a[0]` is not a multiple of `0x1000`? What exactly `__attribute__((aligned(x)))` does? I misunderstood [this][1] explanation? I'm using gcc 4.1.2. [1]: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Variable-Attributes.html#Variable-Attributes

以上就是Are stack variables aligned by the GCC __attribute__((aligned(x)))?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏