You&#x27;re right. Type punning via pointer cast, e.g.<p><pre><code>  int i = ...
  float f = *(float*) &amp;i;
</code></pre>
is not fine (violates strict aliasing). Type punning via union, e.g.<p><pre><code>  union { int i; float f; } u;
  u.i = ...
  float f = u.f;
</code></pre>
is, though (but only in C).<p>Just use memcpy :-)