[Development] Let's get rid of qDebug/qWarning/qCritical!

Koehne Kai Kai.Koehne at digia.com
Wed Jan 8 12:40:33 CET 2014


> -----Original Message-----
> From: Konstantin Ritt [mailto:ritt.ks at gmail.com]
> Sent: Wednesday, January 08, 2014 10:39 AM
> To: Koehne Kai
> Cc: Giuseppe D'Angelo; development at qt-project.org
> Subject: Re: [Development] Let's get rid of qDebug/qWarning/qCritical!
> 
> I have a controversial proposition: make qDebug/qWarning/qCritical support
> logging category and deprecate qCDebug/qCWarning/qCCritical [1].
> 
> [1]  https://codereview.qt-project.org/#change,74889

Originally I wasn't too happy about the qCX names, either. Anyhow, they were introduced to satisfy two demands:

a) we want to keep source compatibility for existing uses of qDebug()

a) the runtime costs for logging to a category/level that's not enabled should be minimal

I guess it's clear we can't break a). To satisfy b), qCDebug expands to a pre-check that skips any evaluation of args etc.  If we want to keep qDebug we'd have to accept that arguments are evaluated (we could try to avoid too expensive operations though by putting logic in operator<<()'s .

Personally, I'm happy to trade the slight awkwardness of the qCDebug name for the benefit of not having to worry too much about potential overhead.

What you and André also seem to suggest is to keep the printf style . That's actually trivial to add to qCDebug and friends if we require support for variadic macros ... qcompilerdetection.h seems to indicate that variadic macros are supported in GCC>=4.3, MSVC>=2005 and Intel>12. IMO that sounds like we could make it a hard requirement?

Regards

Kai


More information about the Development mailing list