Qt Q_UNUSED() 方法的使用

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

 1 //比如说
 2  
 3 int testFunc(int a, int b, int c, int d)
 4 {
 5   int e;
 6   return a+b+c;
 7 }
 8  
 9 //编译器会有警告 d和e未使用;
10  
11 //于是
12 int testFunc(int a, int b, int c, int d)
13 {
14   int e;
15  
16   Q_UNUSED(d)
17   Q_UNUSED(e)
18   return a+b+c;
19 }
20  
21 //多数时候,这样用总不是太好
22  
23 //比如 e,就不该出现,
24  
25 //对于d,也可以 注释掉
26  
27 int testFunc(int a, int b, int c, int  /* d */)
28 {
29   //int e;
30   return a+b+c;
31 }
原文地址:https://www.cnblogs.com/ybqjymy/p/13517194.html