看开源代码时,看到这个字段,有点理解不了
在看vlc代码时,结构体中碰到这个字段:
struct vlc_object_t
{
VLC_COMMON_MEMBERS
};
#define VLC_COMMON_MEMBERS \
/** \name VLC_COMMON_MEMBERS \
* these members are common for all vlc objects \
*/ \
/**@{*/ \
\
............................ \
/* Private data */ \
void * p_private; \
\
/** Just a reminder so that people don't cast garbage */ \
int be_sure_to_add_VLC_COMMON_MEMBERS_to_struct; \
/**@}*/
#define VLC_OBJECT( x ) \
((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct
vlc 函数在使用vlc_object_t该 结构体时,都会首先执行一遍 VLC_OBJECT( x )
但我对于 be_sure_to_add_VLC_COMMON_MEMBERS_to_struct 的使用不是太了解,虽然它加了注释,
我也还是想不明白。