摘要: #define container_of(ptr, type, member) ({ / const typeof( ((type *)0)->member ) *__mptr = (ptr); / (type *)( (char *)__mptr - offsetof(type,member) );}) #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)注意((type *)0)的使用。比如:((void *)0)();((TYPE *)0)->MEMBER;--->这是指MEMBER在 阅读全文
posted @ 2012-12-22 14:32 qimi 阅读(777) 评论(0) 推荐(0) 编辑