Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I remove QDebug header for release?

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?

like image 627
Phil Hannent Avatar asked Aug 10 '09 13:08

Phil Hannent


1 Answers

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.

like image 182
Cătălin Pitiș Avatar answered Sep 17 '22 17:09

Cătălin Pitiș