To add to that, since the referred article doesn't mention it, for GCC there is a "packed" attribute you can set on a data structure.

e.g.

Qt Code:
  1. struct foo
  2. {
  3. char a;
  4. int x[2] __attribute__ ((packed));
  5. };
To copy to clipboard, switch view to plain text mode