http://gcc.gnu.org/onlinedocs/gcc/Typeof.html
typeof is a way to refer to the type of an expression, supported by gcc
e.g.
#define max(a, b)/
({typeof(a) _a = (a);/
typeof(b) )_b =(b);/
_a>_b?_a:_b;})
To declare y as an array of the same type as x:
typeof (x) y[4];
又如: #define pointer(T) typeof(T*)
e.g. to cast a member of a structure to the container structure
#define container_of(ptr, type, member) ({ /
const typeof(((type *)0)->member)) *__mptr = (ptr); /
(type *)( (char *)__mptr - offsetof(type, member)); })
#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)