How to calculate the size of the member in a structure? At the same time, how to calculate the offset address the member in a structure? We can define following MACRO definition to settle these problems.
/* get the size */
#define FSIZE(type, field) ((size_t)(sizeof(((type *)0)->field)))
/* get the offset address */
#define FOFFSET(type, field) ((size_t)&((type *)0)->field)
|
阅读(809) | 评论(0) | 转发(0) |