Skip to content

Instantly share code, notes, and snippets.

@elleryq
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elleryq/caa9913b1fa08b4a7680 to your computer and use it in GitHub Desktop.
Save elleryq/caa9913b1fa08b4a7680 to your computer and use it in GitHub Desktop.
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 */
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment