On Sat, Feb 21, 2015 at 02:05:23PM +0100, FRIGN wrote:
> OLD
> char *name;   /* 4 bytes */ /* 8 bytes */
> int   type;   /* 4 bytes */ /* 4 bytes */
> int   prec;   /* 4 bytes */ /* 4 bytes */
> int   nargs;  /* 4 bytes */ /* 4 bytes */
> int   lassoc; /* 4 bytes */ /* 4 bytes */
> -----------------------------------------
>                 24 bytes      28 bytes
> 
> NEW
> char *name;   /* 4 bytes */ /* 8 bytes */
> char  type;   /* 1 byte  */ /* 1 byte  */
> char  prec;   /* 1 byte  */ /* 1 byte  */
> char  nargs;  /* 1 byte  */ /* 1 byte  */
> char  lassoc; /* 1 byte  */ /* 1 byte  */
> -----------------------------------------
>                  8 bytes      12 bytes

BTW, you also have to take into account trailing padding.

Your calculation for 4-byte pointers is correct but for 8-byte pointers
the total size will be 16 bytes I think.  Still it saves a lot for a large
number of these objects.

Reply via email to