【发布时间】:2011-07-10 14:07:54
【问题描述】:
我有以下代码,当我试图编译它时,我得到一个错误:
错误:“list_item_t”没有名为“state”的成员
有什么创意可以让这段代码在没有警告和错误的情况下编译吗?
#if defined (_DEBUG_)
#define ASSERT assert
#else /* _DEBUG_ */
#define ASSERT( exp ) ((void)(exp))
#endif`
typedef struct list_item {
struct list_item *p_next;
struct list_item *p_prev;
#ifdef _DEBUG_
int state;
#endif
} list_item_t;
main(int argc, char *argv)
{
list_item_t p_list_item;
ASSERT(p_list_item.state == 0);
}
【问题讨论】:
标签: c linux gcc gcc-warning