Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
libc/glibc で container_of() が受け入れられない可能性がある技術的な理由はありますか?
ありがとう、チェンツ
C ライブラリにないマクロと関数は無数にあります。それらのいずれかが存在しない理由は必要ありません。また、Linux カーネルの container_of マクロの有用性は限られています。ただし、 stdlib.h で次のように定義できなかった技術的な理由はないと思います
#define container_of(ptr, type, member) (type*)((char*)(ptr) - offsetof(type, member))