IOFFSETOF ICONTAINEROF IQUEUE_ENTRY】的更多相关文章

#include <iostream> #define IOFFSETOF(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #define ICONTAINEROF(ptr, type, member) ((type*)(((char*)((type*)ptr)) - IOFFSETOF(type, member)) ) #define IQUEUE_ENTRY(ptr, type, member) ICONTAINEROF(ptr,…
#include <iostream> #define IOFFSETOF(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) using namespace std; int main(){ struct Demo{ char sex; int id; }; cout << "IOFFSETOF(Demo, sex): " << IOFFSETOF(Demo, sex) << end…