Skip to content

Instantly share code, notes, and snippets.

@matthiasr
Created May 1, 2011 18:54
Show Gist options
  • Save matthiasr/950737 to your computer and use it in GitHub Desktop.
Save matthiasr/950737 to your computer and use it in GitHub Desktop.
Small test program to test #pragma pack(...) support
#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