Q_UNUSED() 没有实质性的作用,用来避免编译器警告
01 |
//比如说 |
02 |
|
03 |
int testFunc( int a, int b, int c, int d) |
04 |
{
|
05 |
int e; |
06 |
return a+b+c; |
07 |
} |
08 |
|
09 |
//编译器会有警告 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 ) |
28 |
{
|
29 |
//int e; |
30 |
return a+b+c; |
31 |
} |