0
下面的代碼給了我這樣的警告:初始化在C結構陣列的#define
tag_info.h:17: warning: missing braces around initializer
tag_info.h:17: warning: (near initialization for âtag_list_data[0].subtagsâ)
我已經嘗試了很多事情,但似乎沒有奏效。任何人都可以請建議一些
typedef struct Attr{
char attr_name[64];
value_type_t value;
int mandatory;
}Attr_t;
typedef struct Tags {
unsigned int tag_id;
Attr_t *attr_list;
char *tag_name;
int tag_type;
int subtags[html_subtag_num];
}Tags_t;
Tags_t tag_list_data[150] = {
#include "tag_info.h"
{0,0,0,0,0}
};
where the "tag_info.h" contains :
#if defined(TAG_DEFINE)
#undef TAG_DEFINE
#else
#define TAG_DEFINE(a,b,c,...) {.tag_id=a, .tag_name=#b, .tag_type=c, ##__VA_ARGS__}
#endif
TAG_DEFINE(0,TAG_NONE,0,0),
TAG_DEFINE(1,!--,0,0),
TAG_DEFINE(2,!doctype,0,0),
TAG_DEFINE(3,a, 1, 1, 117, 59,11,118,92,100),
你有沒有試過把護腕放在'su的值上? btags'? – 2013-05-14 10:33:41
'tag_info.h'的內容是什麼? – 2013-05-14 10:34:04
如果它包含類似於{{a,b,c},{d,e,f}}的東西,那麼確保在最後有一個*逗號*(或者在{ 0,0,..}') – 2013-05-14 10:35:45