As it does not make sense to generate the size of any occurring type, only typedefs are considered.
The size of the newly defined type is specified for all typedefs. For the name of the size of a typedef, an additional term _SIZE is appended to the end of the name. For structures, the offset of all structure fields is generated relative to the structure's start. The names of the structure offsets are generated by appending the structure field's name after an underline ( _) to the typedef's name.
#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;
Creates:
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
All structure fields inside of another structure are contained within that structure. The generated name contains all the names for all fields listed in the path. If any element of the path does not have a name (e.g., an anonymous union), this element is not generated.
The width and the offset are also generated for all bitfield members. The offset 0 specifies the least significant bit, which is accessed with a 0x1 mask. The offset 2 specifies the most significant bit, which is accessed with a 0x4 mask. 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 structure alignment and the bitfield allocation is determined by the compiler which specifies the correct values.