views:

430

answers:

1

I have a Qt Application and I use qDebug message for my application.

However I have gotten lazy and left in a load of:

#include <QDebug>

in my header files. Should I remove them for a production deployment and what benefit will it give?

+6  A: 

You shouldn't remove the header inclusion. If you do so, every statement involving qDebug might give a compiler error.

Instead, define the symbol QT_NO_DEBUG_OUTPUT when compiling for release. qDebug will do nothing when that symbol is defined and (hopefully) the compiler will optimize away the calls to a function that does nothing.

Cătălin Pitiș