typeof, offsetof, container_of
http://gcc.gnu.org/onlinedocs/gcc/Typeof.html
http://kerneltrap.com/node/15927
http://en.wikipedia.org/wiki/Offsetof
#define offsetof(st, m) \
((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
http://www.kroah.com/log/linux/container_of.html
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
C pre processor
http://tigcc.ticalc.org/doc/cpp.html
http://stackoverflow.com/questions/1552454/can-i-substitute-func-into-an-identifier-name-in-a-c-macro
http://kerneltrap.com/node/15927
http://en.wikipedia.org/wiki/Offsetof
#define offsetof(st, m) \
((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
http://www.kroah.com/log/linux/container_of.html
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
C pre processor
http://tigcc.ticalc.org/doc/cpp.html
http://stackoverflow.com/questions/1552454/can-i-substitute-func-into-an-identifier-name-in-a-c-macro
Comments