Q_UNUSED() 方法的使用

Q_UNUSED() 没有实质性的作用,用来避免编译器警告

//比如说
 
int testFunc(int a, int b, int c, int d)
{
int e;
return a+b+c;
}
 
//编译器会有警告 d和e未使用;
 
//于是
int testFunc(int a, int b, int c, int d)
{
int e;
 
Q_UNUSED(d)
Q_UNUSED(e)
return a+b+c;
}
 
//多数时候,这样用总不是太好
 
//比如 e,就不该出现,
 
//对于d,也可以 注释掉
 
int testFunc(int a, int b, int c, int  /* d */)
{
//int e;
return a+b+c;
}
posted on 2017-03-14 16:55  苦涩的茶  阅读(2325)  评论(0)    收藏  举报

// 1.生成目录索引列表