|
楼主 |
发表于 2009-9-28 09:43:07
|
显示全部楼层
问题是它咋这样用呢?
#define list_entry(ptr, type, member ) container_of(ptr, type, member)
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
里面的
pos = list_entry((head)->next, typeof(*pos), member)
展开之后就变成pos=({ \
const typeof( ((typeof(*pos) *)0)->member ) *__mptr = ((head)->next); \
(typeof(*pos)*)( (char *)__mptr - offsetof(typeof(*pos),member) );})
即 pos=({语句1;语句2;}),这样pos得到的值是啥呢? |
|