[Development] Qt 5.3 header diff: QtCore

Koehne Kai Kai.Koehne at digia.com
Wed Apr 23 10:46:24 CEST 2014



> -----Original Message-----
> [...]
> From: development-bounces+kai.koehne=digia.com at qt-project.org
> These two change combined trigger QTBUG-37283: it's now not possible to
> use qCDebug(cat) on a compiler w/o variadic macros, where cat is a function
> that returns a QLoggingCategory subclass. That's because
> 
>      const QLoggingCategorySubclass &(*)()
> 
> is not a type compatible with CategoryFunction above. Perhaps the header
> can be refactored?

It's true that this is a SC breakage. It's the price we have to pay for getting the printf-style qCDebug version, which was a much requested feature on this mailing list ...

As I commented on QTBUG-37283, the SC breakage happens only if you both sub-class QLoggingCategory (which is IMO a misuse), and compile with e.g. '-ansi' (no variadic macros). Given that QLoggingCategory/qCDebug is a relatively new feature (introduced in 5.2) I personally consider this break to be acceptable.

I now created a documentation patch that explicitly mentions QLoggingCategory shouldn't be subclassed: https://codereview.qt-project.org/#change,83886 . Maybe we can also mark QLoggingCategory with C++11 'final' without breaking BC? Note that the destructor is already non-virtual ...

Regards

Kai


More information about the Development mailing list