elleryq
7/9/2014 - 2:13 AM

padding example (in 64-bit machine) which is from http://www.catb.org/esr/structure-packing/

padding example (in 64-bit machine) which is from http://www.catb.org/esr/structure-packing/

// You wrote:
struct foo1 {
    char *p;
    char c;
    long x;
};

// Actually:
struct foo1 {
    char *p;     /* 8 bytes */
    char c;      /* 1 byte */
    char pad[7]; /* 7 bytes */
    long x;      /* 8 bytes */
};