You copied the Doc URL to your clipboard.

__attribute__((transparent_union)) variable attribute

The transparent_union variable attribute, attached to a function parameter that is a union, means that the corresponding argument can have the type of any union member, but the argument is passed as if its type were that of the first union member.


The C specification states that the value returned when a union is written as one type and read back with another is undefined. Therefore, a method of distinguishing which type a transparent_union is written in must also be passed as an argument.


This variable attribute is a GNU compiler extension that the ARM compiler supports.


You can also use this attribute on a typedef for a union data type. In this case it applies to all function parameters with that type.


Supported in GNU mode only.


typedef union
    int myint;
    float myfloat;
} transparent_union_t;
void Variable_Attributes_transparent_union_0(transparent_union_t aUnion __attribute__((transparent_union)))
    static int aStatic;
    aStatic +=aUnion.myint;
void Variable_Attributes_transparent_union_1()
    int aLocal =0;
    float bLocal =0;