I had previously utilised unions with ease; however, I was startled when I read this post and discovered that this code
pixel.colour = 0xff040201; // ARGB::colour is the active member from now on
// somewhere down the line, without any edit to pixel
if(pixel.components.a) // accessing the non-active member ARGB::components
is in fact unclear behaviour
Reading from a member of the union other than the one to whom you have just written results in ambiguous behaviour.
What is the intended use of unions if not this?
Could someone possibly explain it in more detail?