Does Q_UNUSED have any side effects?

No in many cases (e.g. just passing a simple variable to the macro). The definition is inside qglobal.h:

#  define Q_UNUSED(x) (void)x;

To disable unused variable warnings. You can use the variable after this macro without any problem.

However, if you pass an expression or something else to the macro and the compiler has to evaluate the expression it may has side effects.

Leave a Comment