excellent post!
one thing:

Quote:
Types inside of unions are unrestricted, you can even use structs within unions.
it should be noted that for those using C++ and unions, this is not 100% true.
Unions are restricted to primative types, along with any type that has implicit constructors / destructors. For example:

Code:
struct A {
     int value;
};
 
struct B {
    int value;
   B() :value(100) {}
};
 
union AB {
    A a;
    B b;   //no good
};
At least in GCC, the above will throw a compilation exception.
You can, of course, use POINTERS to arbitarary types, since pointers are primatives.
shabbir like this