24 Nov
2010
24 Nov
'10
9:41 a.m.
Hello, Alexander Kochetkov wrote:
The code like static inline MyObject *impl_from_IMyInterface(IMyInterface *iface) { return (MyObject*)((char*)iface - FIELD_OFFSET(MyObject, IMyInterface_iface)); }
could be replaced with static inline MyObject *impl_from_IMyInterface(IMyInterface *iface) { return container_of(MyObject, IMyInterface_iface); } container_of is Linux Kernel specific. But Windows has such a macro too called CONTAINING_RECORD().
bye michael