[Development] Removing QT_NO_DEBUG_STREAM?

Koehne Kai Kai.Koehne at digia.com
Tue Jan 7 09:42:39 CET 2014


> -----Original Message-----
> From: development-bounces+kai.koehne=digia.com at qt-project.org
> [...]
> [...]
> The typical purpose for debug operators is a convenience, well, in debugging.
> But that costs.

That's an interesting argument. The mere costs saved by QT_NO_DEBUG_STREAM (that is, if it would compile) is to strip out some code of the Qt libraries ... and since the code behind a operator<< is probably negligible what you actually save is exported symbols (115 exported ones in qtbase, if I count correctly).

The maintance costs are, in comparison:
- keep it compilable, check it before a release (hasn't happened in the past, and I don't see it happening if nobody feels personally responsible, or it is checked in the CI)
- put #ifndef/#endif around a lot of code blocks

> That's why many users (and me) uses a cheap qWarning(msg) for warnings and
> #ifndef DEBUG_MY_FEATURE \ qdebug() << various << crap; \ #endif for
> testing/debugging their code.

Individual applications are of course free to continue doing so, and can also define their own MY_DEBUG_STREAM defines if they want to.

But for Qt modules I'd like to encourage everyone to use categorized logging (qCDebug/qCWarning) instead of #infndef DEBUG_MY_FEATURE constructs: This allows you as a developer, as well as users, to switch messages on and off without recompiling. And the overhead should be negliglible in all but the most critical code paths.
 
Regards

Kai

> I'd vote for fixing build with QT_NO_DEBUG_STREAM rather than for deleting
> it.
> 
> Konstantin
> 
> 
> 	--
> 	David Faure | david.faure at kdab.com | Managing Director KDAB
> France
> 	KDAB (France) S.A.S., a KDAB Group company
> 	Tel. France +33 (0)4 90 84 08 53
> <tel:%2B33%20%280%294%2090%2084%2008%2053> , Sweden (HQ) +46-
> 563-540090 <tel:%2B46-563-540090>
> 	KDAB - Qt Experts - Platform-independent software solutions
> 
> 
> 	_______________________________________________
> 	Development mailing list
> 	Development at qt-project.org
> 	http://lists.qt-project.org/mailman/listinfo/development
> 
> 



More information about the Development mailing list