慕莱坞森
最近的GCC(经4.5.2-8ubuntu4测试)似乎可以正常工作,并且阵列正确对齐。#include <stdio.h>int main(void){ float a[4] = { 1.0, 2.0, 3.0, 4.0 }; float b[4] __attribute__((aligned(0x1000))) = { 1.0, 2.0, 3.0, 4.0 }; float c[4] __attribute__((aligned(0x10000))) = { 1.0, 2.0, 3.0, 4.0 }; printf("%p %p %p %p\n", &a[0], &a[1], &a[2], &a[3]); printf("%p %p %p %p\n", &b[0], &b[1], &b[2], &b[3]); printf("%p %p %p %p\n", &c[0], &c[1], &c[2], &c[3]);}我得到:0x7ffffffefff0 0x7ffffffefff4 0x7ffffffefff8 0x7ffffffefffc0x7ffffffef000 0x7ffffffef004 0x7ffffffef008 0x7ffffffef00c0x7ffffffe0000 0x7ffffffe0004 0x7ffffffe0008 0x7ffffffe000c