【发布时间】:2016-02-20 01:14:28
【问题描述】:
在带有 gcc 编译器的 X86_64 英特尔处理器中,“C”结构中成员的默认对齐方式是什么。它是否与自然边界自我对齐?
【问题讨论】:
-
你可以通过打印出结构的几个成员的内存地址来找到你要找的东西。
printf("Memory address of variable i is %d from the beginning of the struct",&(structure.variablei)-&structure); -
这是由您使用的 ABI 定义的,通常由您的操作系统决定。在大多数(全部?)类 Unix 系统上,您想查看System V ABI。 SO帖子的详细信息太长了。