title: Strange pointer behaviour
body: <p>I have a buffer containing data which was previously read from socket.
  From the information stored in the buffer,
  I can tell the entire data length (91 Bytes) and from specification,
  I know the positions of other information I need to retrieve (32bit integer and 16bit integer, lets call them uid and suid).</p>
  
  <pre><code>unsigned char buffer[1024];
  uint32_t uid;
  uint16_t suid;
  
  uid = ntohl ( *((uint32_t*) (buffer + sizeof (struct pktheader))) );
  
  suid = ntohs ( *((uint16_t*) (buffer + sizeof (struct pktheader) + sizeof (uint32_t))) );
  </code></pre>
  
  <p>This code was cross-compiled for ARM and for some unexpected reasons content of <strong>uid</strong> was filled with incorrect bytes which were part of the buffer but were residing before (!) the content I meant to retrieve.
  As if the offset was calculated incorrectly.
  Strangely enough content of <strong>suid</strong> was just fine.</p>
  
  <p>Can you explain how is this behaviour even possible? I know it may be difficult from information I provided... We can rule out incorrect value of <code>sizeof (struct pktheader)</code>, I have double checked. The content in the buffer is as defined in specification. I even found a working solution using memcpy using same offset calculation to get each part out, so we can pretty much rule out a possibility of mingled data.</p>
  
  <p>I discussed it with my colleague and his professional guess was that some auto-alignment behaviors happened pointing out that offset was just 2 Bytes off. However I would like to know more.</p>
  
  <p>Until now I was quite fond of this construction in order to access individual parts stored in buffers.</p>