Hi, > typedef union { > struct { > unsigned URSTIE : 1; > unsigned UERRIE : 1; > unsigned ACTVIE : 1; > unsigned TRNIE : 1; > unsigned IDLEIE : 1; > unsigned STALLIE : 1; > unsigned SOFIE : 1; > unsigned : 1; > }; > } __UIE_t; > > Now what I would like to understand is why this is 'union/struct' > instead of just a 'struct'?
This code is generated and is generic to allow multiple names for any given bit using something like typedef union { struct { unsigned URSTIE : 1; unsigned UERRIE : 1; unsigned ACTVIE : 1; unsigned TRNIE : 1; unsigned IDLEIE : 1; unsigned STALLIE : 1; unsigned SOFIE : 1; unsigned : 1; }; struct { unsigned alt_URSTIE : 1; unsigned alt_UERRIE : 1; unsigned alt_ACTVIE : 1; unsigned alt_TRNIE : 1; unsigned alt_IDLEIE : 1; unsigned alt_STALLIE : 1; unsigned alt_SOFIE : 1; unsigned : 1; }; } __UIE_t; Some SFR actually use this. To simplify the generator, *all* structs are wrapped in unions. Best regards Raphael ------------------------------------------------------------------------------ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user