全部,
我有以下 C 代码,当我编译时,
static struct
{
const char* val;
const char* parse_key;
int len; //parse key length
void (*parse_routine) (const char* after, rtsp_sdp_t* response);
} sdp_header[] =
{
#define SDP_FILL_STRUCT(a,b) {#a, b, strlen(b), sdp_##a}
SDP_FILL_STRUCT(attr_control, "a=control:"),
SDP_FILL_STRUCT(attr_framerate,"a=framerate:"),
SDP_FILL_STRUCT(attr_range, "a=range:"),
{'\0', '\0', 0, (void*)0},
};
为什么它会给出以下错误:
:330: warning: initializer element is not constant
:330: warning: (near initialization for 'sdp_header[0]')
:331: warning: initializer element is not constant
:331: warning: (near initialization for 'sdp_header[1]')
:332: warning: initializer element is not constant
:332: warning: (near initialization for 'sdp_header[2]')
:333: warning: initializer element is not constant
不知道具体是什么原因,求大神帮忙看看。谢谢