原来的问题:
[PHP]
struct lookup { /*一开始没看到这段声明问了个傻问题*/
const char * l_word;
const int l_value;
};
static struct lookup const * byword P((const char * string,
const struct lookup * lp));
static struct lookup const mon_names[] = {
{ "January", TM_JANUARY },
{ "February", TM_FEBRUARY },
{ "March", TM_MARCH },
{ "April", TM_APRIL },
{ "May", TM_MAY },
{ "June", TM_JUNE },
{ "July", TM_JULY },
{ "August", TM_AUGUST },
{ "September", TM_SEPTEMBER },
{ "October", TM_OCTOBER },
{ "November", TM_NOVEMBER },
{ "December", TM_DECEMBER },
{ NULL, 0 }
};
static struct lookup const wday_names[] = {
{ "Sunday", TM_SUNDAY },
{ "Monday", TM_MONDAY },
{ "Tuesday", TM_TUESDAY },
{ "Wednesday", TM_WEDNESDAY },
{ "Thursday", TM_THURSDAY },
{ "Friday", TM_FRIDAY },
{ "Saturday", TM_SATURDAY },
{ NULL, 0 }
};
[/PHP]
请问这种struct xxxx const xxxx[]={} 是什么用法?
解答:这是因为个人失误 没有看到对结构体 lookup 的定义,这两个只是lookup结构体的2个常数型变量数组。
问题来了 : 这个函数声明真奇怪,哪位仁兄可以解释一下
[php]static struct lookup const * byword P((const char * string,
const struct lookup * lp));
[/php] |