06 2013 档案

C语言内的封装
摘要:前提 在翻libevent代码的时候,看到一段C的技巧记录下来:1 #define TAILQ_HEAD(name, type) 2 struct name { 3 struct type *tqh_first; /* first element */ 4 struct type **tqh_last; /* addr of last next element */ 5 }这样就通过预编译实现双链表结构体的定义。1 #ifdef _EVENT_DEFINED_TQENTRY2 #undef TAILQ_ENTRY3 struct event_list;4 struct evkey... 阅读全文

posted @ 2013-06-09 17:12 毛毛鼠 阅读(208) 评论(0) 推荐(0)