【问题解决】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 )

解决:

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

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

猜你喜欢

转载自blog.csdn.net/p1279030826/article/details/119144570
今日推荐