2023-04-03T03:27:17Z
C语言 ({}) 表达式返回最后一个表达式的值,如x=({a;b;c;d;}),最终x的值应该是d。来源于 container_of
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE*)0)->MEMBER)
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (const typeof( ((type *)0)->member ) *)(ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})