Use of Q_UNUSED () method

Q_UNUSED () has no substantial effect and is used to avoid compiler warnings

// For example 
 
int testFunc ( int a, int b, int c, int d) 
{ 
int e;
 return a + b + c; 
} 
 
// The compiler will warn that d and e are not used; 
 
// So 
int testFunc ( int a, int b, int c, int d) 
{ 
int e; 
 
Q_UNUSED (d) 
Q_UNUSED (e) 
return a + b + c; 
} 
 
// most of the time, this is not always very good. 
 
// For example, e should not appear , 
 
// For d, you can also comment out 
 
int testFunc(int a, int b, int c, int  /* d */)
{
//int e;
return a+b+c;
}

 

Guess you like

Origin www.cnblogs.com/sggggr/p/12676315.html