<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>Hi Rémi,</p>
<p>On 2017-02-20 18:45, Rémi Denis-Courmont wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> Le maanantaina 20. helmikuuta 2017, 15.06.59 EET Filip Roséen a écrit :</code></pre>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> If a compiler introduce padding between the members of struct
 xa_header, the previous way of interpreting the incoming stream will
 yield unexpected behavior.</code></pre>
</blockquote>
<pre><code> I do not see how a comforming C compiler could introduce padding anywhere 
 except at the end of the structure - since all types are aligned on their 
 natural boundary.</code></pre>
</blockquote>
<p>There is nothing to prevent a comforming compiler to not introduce padding even though the relevant <em>data-members</em> are aligned to their natural boundary. At least I have not stumbled across any such guarantee when spending time with the ISO C Standards (I would however be happy to be corrected).</p>
<p>The guarantees related to padding within a <code>struct</code> are available in <code>6.7.2.1/15</code> of <code>N1570</code> (the contents is the same for the official ISO document (which I cannot remember the <em>N-number</em> for at the top of my head).</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> (So yes, there is a bug, but the fix should be much more trivial.)</code></pre>
</blockquote>
<p>I think the current fix is trivial enough, especially given what was stated in the previous section.</p>
<p>Best Regards,<br />
Filip</p>
</body>
</html>