Last active
August 29, 2015 14:03
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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