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;
}

相关文章:

  • 2022-01-02
  • 2022-12-23
  • 2021-07-18
  • 2021-12-18
  • 2022-01-21
  • 2021-07-30
  • 2021-10-22
  • 2021-11-09
猜你喜欢
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-02-18
相关资源
相似解决方案