title: What does #pragma pack () call do?
body: <p>I was given the following structs:</p>
  
  <pre><code>struct s2 {
  int f0;
  char f1;
  unsigned long long f2;
  unsigned long f3;
  short f4;
  long f5;
  };
  
  #pragma pack (1)
  struct s2_packed {
  int f0;
  char f1;
  unsigned long long f2;
  unsigned long f3;
  short f4;
  long f5;
  };
  #pragma pack ()
  
  struct s3 {
  unsigned short f0;
  int f1;
  unsigned int f2;
  int f3;
  unsigned short f4;
  char f5;
  };
  </code></pre>
  
  <p>I understand <code>s2_packed</code> should be packed now, but is <code>s3</code> packed? What does the call <code>#pragma pack ()</code> do?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I just examined the bytes in s3 and they are indeed packed.. Not sure whats going on here, any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here is my <code>makefile</code> I was given:</p>
  
  <pre><code>all: 
   gcc -m32 -g -O -Wall struct.c main.c -o struct
  
  clang:
   clang -m32 -g -O -Wall struct.c main.c -o struct
  
  strict:
   gcc -m32 -g -O -Wall -Werror struct.c main.c -o struct
  
  clang-strict:
   clang -m32 -g -fsanitize=undefined -O -Wall -Werror struct.c main.c -o struct
  
  clean:
   rm -f struct
  </code></pre>