You copied the Doc URL to your clipboard.

__attribute__((transparent_union)) type attribute

The transparent_union type attribute enables you to specify a transparent union type.

When a function is defined with a parameter having transparent union type, a call to the function with an argument of any type in the union results in the initialization of a union object whose member has the type of the passed argument and whose value is set to the value of the passed argument.

When a union data type is qualified with __attribute__((transparent_union)), the transparent union applies to all function parameters with that type.


typedef union { int i; float f; } U __attribute__((transparent_union));
void foo(U u)
    static int s;
    s += u.i;    /* Use the 'int' field */
void caller(void)
    foo(1);        /* u.i is set to 1 */
    foo(1.0f);     /* u.f is set to 1.0f */