例:
typedef struct
{unsigned shortcrc; /* CRC16 over data bytes*/
unsigned chardata[1]; /* Environment data - variable lenth */
}env_t;
求data[0]偏移地址 =>
offset = (unsigned long )((env_t*)0)->data[0];
使用宏写成通用的方式 =>
#define struct_off(type, field) (unsigned long)( (type*)0 )->field