【Linux C】offsetof與container_of宏

offsetof是用來判斷結構體中成員的偏移位置,container_of宏用來根據成員的地址來獲取結構體的地址; offsetof宏   使用offsetof宏需要包含stddef.h頭文件,實例可以參考:http://www.cplusplus.com/reference/cstddef/offsetof/。       offsetof宏的定義如下: #define offsetof(typ
相關文章
相關標籤/搜索