COM_INTERFACE_ENTRY 的 offsetofclass
有看过COM的表格驱动查找Interface的代码的朋友吗?
我有一个疑问,
#define offsetofclass(base, derived) ((DWORD)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING)
为什么不改为
#define addressofclass(base, derived) ((DWORD)(static_cast<base*>(this))
这样不是不用做(char*)this + offsetofclass运算,而直接得到地址。