Last active
February 12, 2016 16:55
-
-
Save kkabdol/831d0be4d47e225c7f1a to your computer and use it in GitHub Desktop.
#pragma pack(1)
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
#pragma pack(1) | |
struct s_t { // sizeof s_t = 11 | |
char a; // offset = 0, align = 1 | |
int b; // offset = 1, align = 1 | |
short c; // offset = 5, align = 1 | |
int d; // offset = 7, align = 1 | |
}S; | |
#pragma pack() | |
struct s_t { // sizeof s_t = 11 | |
char a; // offset = 0, align = 1 | |
int b; // offset = 4, align = 4 | |
short c; // offset = 8, align = 2 | |
int d; // offset = 12, align = 4 | |
}S; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment