[Development] QNoDebug - available but undocumented

Olivier Goffart olivier at woboq.com
Fri Jul 31 11:10:15 CEST 2015


On Friday 31. July 2015 08:48:24 Curtis Mitch wrote:
> > #ifdef DEBUG_FETCHER
> >     #define fetcherDebug qDebug()
> > #else
> >     #define fetcherDebug NoDebug()
> > #endif
> > 
> > as a temporary solution to enable debug output of a new feature.
> 
> What's the benefit of this over QLoggingCategory?

QLoggingCategory checks at runtime if the debug should be run. Which means 
that the compiler still need to generate the code for it.
With the QNoDebug trick, everything can be removed at compile time, and 
nothing is generated in the binary for those debug statements.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org



More information about the Development mailing list