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

Koehne Kai Kai.Koehne at digia.com
Thu Jan 9 20:30:24 CET 2014


>From: Poenitz Andre
>
>Koehne Kai wrote:
>> On quinta-feira, 9 de janeiro de 2014 07:28:07, Koehne Kai wrote:
>> > if qCWarning() would expand to an if (myCategory().isEnabled()) ...
>>
>> That's why it would have to expand to if (!myCategory().isEnabled()) {} else
>>
>> Well, we can't, since the << arguments are not part of the macro :) That would end up with s.th. lie
>>
>> if (!myCategory().isEnabled()) { QMessageLogger(__FILE__, __LINE__, __FUNCTION__).debug() {} else {} << >"Hello World";
>>
>> which doesn't compile.
>
>This is only a problem because you insist on creating partial statements
>with the macro instead of full statements.

True.

>If the "streaming syntax" would be
>
>    qFoo(myCategory(), a << b << c);
>
>instead of
>
>    qFoo(myCategory()) << a << b << c;
>
>there's no "else" to worry about, 

Right, but I can't say that I prefer the first syntax over the second, all the contrary.

> and it would also solve the problem of
>a "compile time" "null stream":
>
>    #define qFoo(stream, stuff) /*nothing*/

Well, right now it resolves to

'while (false) QMessageLogger::noDebug() <<', which is the same in effect, isn't it?

>We had this discussion before.

Could be :)

Kai


More information about the Development mailing list