Qt宏之Q_UNUSED

来源:互联网 发布:写文档的软件 编辑:程序博客网 时间:2024/04/28 06:28
原帖在这里:http://blog.csdn.net/locky1218/article/details/10161873
Q_UNUSED() 没有实质性的作用,用来避免编译器警
//比如说
02 
03int testFunc(int a, int b, int c, int d)
04{
05int e;
06return a+b+c;
07}
08 
09//编译器会有警告 d和e未使用;
10 
11//于是
12int testFunc(int a, int b, int c, int d)
13{
14int e;
15 
16Q_UNUSED(d)
17Q_UNUSED(e)
18return a+b+c;
19}
20 
21//多数时候,这样用总不是太好
22 
23//比如 e,就不该出现,
24 
25//对于d,也可以 注释掉
26 
27int testFunc(int a, int b, int c, int  /* d */)
28{
29//int e;
30return a+b+c;
31}