Created
May 1, 2011 18:54
-
-
Save matthiasr/950737 to your computer and use it in GitHub Desktop.
Small test program to test #pragma pack(...) support
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
#include <stdio.h> | |
#pragma pack(push) | |
#pragma pack(1) | |
struct { | |
char a; | |
int b; | |
char c; | |
} packed; | |
#pragma pack(pop) | |
struct { | |
char a; | |
int b; | |
char c; | |
} unpacked; | |
int main(int argc, char** argv) | |
{ | |
printf("sizeof(packed) = %lu, sizeof(unpacked) = %lu\n", | |
sizeof(packed), sizeof(unpacked)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment