Is it a good practice to use unions in C++?
<p>I need to define a class like this:</p>

<pre><code>class Color
{
private:
   union Data
   {
       unsigned int intValue;
       unsigned char argbBytes[4];
   }

private:
    Data m_data;
};
</code></pre>

<p>Another way is of course define the data as integer and cast it to char array whenever necessary.</p>

<p>I'm wondering which one is the preferred way. The contradiction here is that I have remote memory of someone's remind not to use union anymore however it seems to be a cleaner solution in this case.</p>
