warning: ordered comparison of pointer with integer zero [-Wextra]

问题:

struct menu_type
{
  const unsigned char *icon;
    ...
};

static struct menu_type menu_list[] =
{
    ...
};

while( menu_list[i].icon > 0 )

gcc编译报警告:

warning: ordered comparison of pointer with integer zero [-Wextra]
   while( menu_list[i].icon > 0 )


2解决:

修改为以下值就不会报警告了

 while( menu_list[i].icon > (unsigned char *)0 )
 或者
while( menu_list[i].icon > (unsigned char *)NULL )


 

你可能感兴趣的:(C语言,c语言)