#include #include #include #include #ifndef STAILQ_LAST #define STAILQ_LAST(head, type, field) \ (STAILQ_EMPTY((head)) ? \ NULL : \ ((struct type *)(void *) \ ((char *)((head)->stqh_last) - offsetof(struct type, field)))) #endif struct foo { int a, b; STAILQ_ENTRY(foo) next; }; int main(int argc, char* argv[]) { STAILQ_HEAD(, foo) stailq; STAILQ_LAST(&stailq, foo, next); return 0; }