你知道为什么我会从这段代码中得到这些错误吗?
#define container_of(ptr, type, member) ({\
const typeof( ((type *)0)->member ) *__mptr = (ptr);\
(type *)( (void *) ( (char *)__mptr - offsetof(type,member) ) );})
error: expected declaration specifiers or '...' before '(' token
error: '__mptr' undeclared (first use in this function)
最佳答案
感谢您的帮助!
用两侧各有两个下划线的 typeof 替换 'typeof' 解决了问题。
关于c - #定义错误: expected declaration specifiers or '...' before '(' token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27029643/