Skip to content

Comment on The Lost Art of C Structure Packing

Comments

In the example in part 4, doesn't this:

    char *p;     /* 8 bytes */
    long x;      /* 8 bytes */
    char c;      /* 1 byte  */
Just end up being this, to align whatever comes after it in memory?
    char *p;     /* 8 bytes */
    long x;      /* 8 bytes */
    char c;      /* 1 byte  */
    char pad[7]; /* 7 bytes */
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.