title: C union assignment
body: <p>I have union that represent some structures that all uint32 type but with different bit-fields. can i do assignment of one union to other like this:</p>
  
  <pre><code>typedef union foo_u
  {
     // raw
     uint32_t foo32;
  
     // interpretation 1
     struct
     {
        uint16_t a;
        uint16_t b;
     } foo_flavor1;
  
     //interpretation 2
     struct
     {
        uint32_t a        : 16;
        uint32_t b        : 12;
        uint32_t c        : 4;
     } foo_flavor2;
  } foo;
  foo a;
  foo b;
  a.foo32 = 10;
  b.foo32 = 30;
  b=a;
  </code></pre>
  
  <p>or i have to do the assignment like this:</p>
  
  <pre><code>b.foo32 = a.foo32; 
  </code></pre>