考虑下面的结构声明:
struct prob { int *p; struct { int x; int y; } s; struct prob *next; };
这个声明说明一个结构可以嵌套在另一个结构中,就像数组可以嵌套在结构中、数组可以嵌套在数组中一样。
下面的过程(省略了某些表达式)对这个结构进行操作:
void sp_init (struct prob *sp) *[ sp->s.x = () ; sp->p =(); sp->next =(); }
A. 下列字段的偏移量是多少(以字节为单位)?
p:()
s.x:()
s.y:()
next:()
B. 这个结构总共需要多少字节?
C.编译器为sp_init的主体产生的汇编代码如下:
sp_init: movl 12(%rdi),%eax movl %eax,8(%rdi) leaq 8(%rdi),%rax movq %rax,(%rdi) movq %rdi,16(%rdi) ret
根据这些信息,填写sp_init代码中缺失的表达式