可能重复:
为什么这个 C 代码有效?
为什么此用于查找结构中字段偏移量的代码不给出 segfault ?
#define offset(structName,fieldName) (&((structName *)0)->fieldName)
可能重复:
为什么这个 C 代码有效?
为什么此用于查找结构中字段偏移量的代码不给出 segfault ?
#define offset(structName,fieldName) (&((structName *)0)->fieldName)