title: struct alignment
body: <pre><code>#define MAX_SIZE 8
  
  enum my_enum
  {
      VAL1 = 0;
      VAL2,
      VAL3,
      VAL4,
      VAL_MAX
  };
  
  struct my_struct
  {
    enum my_enum e;
    int  w[MAX_SIZE];
  };
  </code></pre>
  
  <p>Can a layout in such structure cause alignment issues on a target platform? I understand it much depends on a platform, but generally C compiler is allowed to do padding of structures, so for example on 32 bit machine, where 'int' is 32 bit long:</p>
  
  <pre><code>struct my_struct
  {
      int w[MAX_SIZE];
  }
  </code></pre>
  
  <p>is aligned (as fas as I understand) so compiler probably won't be doing anything else with its layout, but adding 'enum my_enum' in the structure can poptentially get the structure un-aligned on such machine.  Should I be doing anything special to avoid this and should I be avoiding it at all ?</p>
  
  <p>Would be very thankful for clarifications!</p>
  
  <p>Mark</p>