There is no reason to generate the size of every occurring type, therefore only typedefs are considered here.
The size of the newly defined type is specified for all typedefs.
#pragma CREATE_ASM_LISTING ON typedef long LONG; struct tagA { char a; short b; }; typedef struct { long d; struct tagA e; int f:2; int g:1; } str;
The Compiler appends the term _SIZE to the end of the typedef's name for the size name. For structures, the Compiler generates the offset of all structure fields relative to the structure's start, and generates the structure offset names by appending an underscore (_) and the structure field's name to the name of the typedef as shown in the following listing.
LONG_SIZE EQU $4 str_SIZE EQU $8 str_d EQU $0 str_e EQU $4 str_e_a EQU $4 str_e_b EQU $5 str_f EQU $7 str_f_BIT_WIDTH EQU $2 str_f_BIT_OFFSET EQU $0 str_g EQU $7 str_g_BIT_WIDTH EQU $1 str_g_BIT_OFFSET EQU $2
The Compiler contains all structure fields within that structure. The generated name contains all the names for all fields listed in the path. The Compiler ignore any element without a name (for example, an anonymous union).
The Compiler also generates the width and offset for all bitfield members. The offset 0 specifies the least significant bit, which is accessed with mask 0x1. The offset 2 specifies the most significant bit, which is accessed with mask 0x4. The width specifies the number of bits.
The offsets, bit widths, and bit offsets given here are examples. Different compilers may generate different values. In C, the Compiler determines the structure alignment and bitfield allocation and specifies the correct values.