Author mark.dickinson
Recipients Alexander.Belopolsky, MrJean1, ajaksu2, barry, benjamin.peterson, inducer, mark.dickinson, meador.inge, noufal, pitrou, teoliphant
Date 2010-05-20.17:30:35
SpamBayes Score 0.00613471
Marked as misclassified No
Message-id <1274376637.08.0.800725015034.issue3132@psf.upfronthosting.co.za>
In-reply-to
Content
> 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                                                                    
*/
History
Date User Action Args
2010-05-20 17:30:37mark.dickinsonsetrecipients: + mark.dickinson, barry, teoliphant, pitrou, inducer, ajaksu2, MrJean1, benjamin.peterson, noufal, meador.inge, Alexander.Belopolsky
2010-05-20 17:30:37mark.dickinsonsetmessageid: <1274376637.08.0.800725015034.issue3132@psf.upfronthosting.co.za>
2010-05-20 17:30:35mark.dickinsonlinkissue3132 messages
2010-05-20 17:30:35mark.dickinsoncreate