[Development] Compiler warnings

Kevin Kofler kevin.kofler at chello.at
Thu Oct 16 19:46:36 CEST 2014


Smith Martin wrote:
> But maintaining binary compatibility is now a necessary facet of software
> engineering, so maybe it is time for the C++ standard to support it. A
> keyword could be added to the parameter declaration, "compatibility" or
> "placeholder" for example, could precede a parameter declaration that is
> kept for binary compatibility. The compiler would not warn that the
> parameter was not used.

The lack of a name for the parameter is already how the C++ standard 
specifies unused parameters, and g++ normally does NOT warn in that case.

In addition, GCC/g++ has supported __attribute__((unused)) for ages. For Qt 
code, there's also the Q_UNUSED macro, which is used in the function itself, 
and which should work with most (if not all) compilers out there. But all 
those should not be needed in cases where you can simply omit the parameter 
name.

        Kevin Kofler




More information about the Development mailing list