Message106173
> For example, I would expect the same padding for 'BT{I}' and 'BI'.
Granted, yes. But I wouldn't expect the same padding for 'BT{BI}' and 'BBI'. 'BT{BI}' should match a C struct which itself has an embedded struct. For C, I get the following results on my machine:
#include <stdio.h>
/* corresponds to 'T{BI}' */
typedef struct {
char y;
int z;
} A;
/* corresponds to 'BT{BI}' */
typedef struct {
char x;
A yz;
} B;
/* corresponds to 'BBI' */
typedef struct {
char x;
char y;
int z;
} C;
int main(void) {
printf("sizeof(A) = %zu\n", sizeof(A));
printf("sizeof(B) = %zu\n", sizeof(B));
printf("sizeof(C) = %zu\n", sizeof(C));
return 0;
}
/*
Results on a (64-bit) OS X 10.6 machine:
sizeof(A) = 8
sizeof(B) = 12
sizeof(C) = 8
*/ |
|
Date |
User |
Action |
Args |
2010-05-20 17:30:37 | mark.dickinson | set | recipients:
+ mark.dickinson, barry, teoliphant, pitrou, inducer, ajaksu2, MrJean1, benjamin.peterson, noufal, meador.inge, Alexander.Belopolsky |
2010-05-20 17:30:37 | mark.dickinson | set | messageid: <1274376637.08.0.800725015034.issue3132@psf.upfronthosting.co.za> |
2010-05-20 17:30:35 | mark.dickinson | link | issue3132 messages |
2010-05-20 17:30:35 | mark.dickinson | create | |
|