正在加载图片...
Problem 3.23(P200) For each of the following structure declarations, determine the offset of each field, the total size of the structure, and its alignment requirement under Linux/A32 A. struct plint i; char c; int j; char d; 1: 1.除cha, short外, linux下gcc B struct paint i; char c; char d; int j: 1 默认为4 bytes aligned C. struct p3(short w[3]; char c[3] ] 2.同类型数据若连续声明,则 D. struct p4short w[3]; char*c[3]; 1 可连续存放。 E. struct p5(struct p1 a[2]; struct p2 *p: 1 a p Total Alignment 0 32 36 4 D Total Alignment 0 20 4Problem 3.23 (P200) For each of the following structure declarations, determine the offset of each field, the total size of the structure, and its alignment requirement under Linux/IA32. A. struct p1{int i; char c; int j; char d;}; B. struct p2{int i; char c; char d; int j;}; C. struct p3{short w[3]; char c[3];}; D. struct p4{short w[3]; char *c[3];}; E. struct p5{struct p1 a[2]; struct p2 *p;}; A i c j d Total Alignment 0 4 8 12 16 4 B i c j d Total Alignment 0 4 5 8 12 4 C w c Total Alignment 0 6 10 2 D w c Total Alignment 0 8 20 4 E a p Total Alignment 0 32 36 4 1. 除char,short外,linux下gcc 默认为4-bytes aligned。 2. 同类型数据若连续声明,则 可连续存放
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有