[Development] QLog ( Work on qDebug and friends)

Lincoln Ramsay lincoln.ramsay at nokia.com
Fri Feb 10 00:29:59 CET 2012

On 02/10/2012 01:16 AM, ext BRM wrote:
> That said, there may be a place for having a compile time option to
> entirely disable it too - e.g. for distributions and commercial
> (Digia) binary releases to be able to completely disable it on
> release builds.

Removing the logging statement entirely is achieved by expanding the 
macro to:
if (1) /*NOP*/; else qDebug()

Technically, you'd have to wrap the logging statement in a #ifdef/#endif 
pair to ensure it's completely removed but I think compilers can 
correctly determine that the else is never hit (due to the constant in 
the if) and so omit that code from the binary. Certainly, that code will 
never be run when the macro expands this way.

Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/

More information about the Development mailing list