Review Request 128114: do not load and debug in the same line
Harald Sitter
sitter at kde.org
Tue Jun 7 09:06:21 UTC 2016
> On June 7, 2016, 8:53 a.m., Aleix Pol Gonzalez wrote:
> > Are you sure that's the case? Is C++ that smart that it can decide not to execute part of the stream?
C++ isn't, Qt is.
In some build configs (e.g. gcc) qCDebug becomes noop as the macro essentially expands to a fancy `if-enabled { log(va_args) }` meaning no streaming happens at all unless the category is enabled.
Utlimately the same would happen with nodebug builds btw, they also turn everything after the macro invocation noop by means of an always-false evaluation.
tldr: never call mutating code from inside the qDebug arguments as it can be noop because of Qt
- Harald
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128114/#review96247
-----------------------------------------------------------
On June 7, 2016, 8:48 a.m., Harald Sitter wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128114/
> -----------------------------------------------------------
>
> (Updated June 7, 2016, 8:48 a.m.)
>
>
> Review request for KDE Frameworks, Andreas Cord-Landwehr and Jeremy Whiting.
>
>
> Repository: knewstuff
>
>
> Description
> -------
>
> if debugging is off the line is no-op and the load never happens, thus
> breaking the test since the entry is always empty.
>
> broke as result of review 126017
>
>
> Diffs
> -----
>
> autotests/knewstuffentrytest.cpp a886afc514abfa21b6396a8b2c8c3a88d65b4a5d
>
> Diff: https://git.reviewboard.kde.org/r/128114/diff/
>
>
> Testing
> -------
>
> makes && passes test
>
>
> Thanks,
>
> Harald Sitter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160607/cac93b2f/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list