title: What are the exact rules for structure alignment on iPhone OS?
body: <p>I'm using the Objective-C NSMethodSignature / @encode facilities to do some cross-language data type translation, which means that I need to be able to programmatically copy values into a structure described in @encode() format.  e.g., I may have 4 floats and need to insert them into a CGRect, which is a structure containing 2 structures, each of which contains 2 floats each.  In @encode terminology, the type is this:</p>
  
  <pre><code>{CGRect={CGPoint=ff}{CGSize=ff}}
  </code></pre>
  
  <p>To do this I need to be able to guess the structure layout knowing only the data types of the primitive structure members -- in this case 4 floats.</p>
  
  <p>It appears that historically there have been two different conventions for ARM struct alignment.  One was to align all members of the struct on a boundary size which would satisfy the largest member.  The other was to align all members on the boundary size appropriate to each member's data type.</p>
  
  <p>Which is used in OS X / iPhone OS, both on ARM and on x86 / x86_64?</p>