#include <stdio.h>
struct a
{
};
struct b
{
void (*max)(int a, int b);
void (*min)(int a, int);
};
int main()
{
printf("%d\n", sizeof(struct a)); /* 0 */
printf("%d\n", sizeof(struct b)); /* 8 */
}
#if 0
08048430 <main>:
8048430: 55 push %ebp ; 保存旧的栈顶值
8048431: 89 e5 mov %esp,%ebp ; ebp指向栈顶
8048433: 83 e4 f0 and $0xfffffff0,%esp ; 令栈地址(ESP的值)向16字节边界对齐(成为16的整数倍)
8048436: 83 ec 10 sub $0x10,%esp ; 分配栈空间
8048439: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) ; 第二个参数, esp+4 = 0
8048440: 00
8048441: c7 04 24 04 85 04 08 movl $0x8048504,(%esp) ; 第一个参数, "%d"
8048448: e8 a3 fe ff ff call 80482f0 <printf@plt> ; 调用printf
804844d: c7 44 24 04 08 00 00 movl $0x8,0x4(%esp) ; 第二个参数, esp+4 = 8
8048454: 00
8048455: c7 04 24 04 85 04 08 movl $0x8048504,(%esp) ; 第一个参数, "%d"
804845c: e8 8f fe ff ff call 80482f0 <printf@plt> ; 调用printf
8048461: c9 leave
8048462: c3 ret
8048463: 66 90 xchg %ax,%ax
8048465: 66 90 xchg %ax,%ax
8048467: 66 90 xchg %ax,%ax
8048469: 66 90 xchg %ax,%ax
804846b: 66 90 xchg %ax,%ax
804846d: 66 90 xchg %ax,%ax
804846f: 90 nop
#endif