Is this a violation of strict aliasing rules? : <p>According to the standard — <em>an aggregate or union type that includes one of the aforementioned types among its elements or nonstatic data members (including, recursively, an element or non-static data member of a subaggregate or contained union)</em>, this is allowed:</p>

<pre class="lang-cpp prettyprint-override"><code>struct foo {
  float x;
};

void bar(foo*);

float values[9];
bar(reinterpret_cast&lt;foo*&gt;(&amp;values));
</code></pre>

<p>However, I am not sure whether the following example also honors this rule:</p>

<pre class="lang-cpp prettyprint-override"><code>struct foo {
  float x;
  float y;
  float z;
};

void bar(foo*);

float values[9];
assert((sizeof(values) / sizeof(float)) % 3 == 0);  // sanity check
bar(reinterpret_cast&lt;foo*&gt;(&amp;values));
</code></pre>
